0100 01 en BuildingLibrariesForWindowsOnArm
0100 01 en BuildingLibrariesForWindowsOnArm
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Release information
Document history
Issue Date Confidentiality Change
1.0 21st June 2021 Non-Confidential First release
Your access to the information in this document is conditional upon your acceptance that you will not use or
permit others to use the information for the purposes of determining whether implementations infringe any
third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES,
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A
PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, Arm makes no
representation with respect to, and has undertaken no analysis to identify or understand the scope and content
of, patents, copyrights, trade secrets, or other rights.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES,
INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR
CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use,
duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure
that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws.
Use of the word “partner” in reference to Arm's customers is not intended to create or refer to any partnership
relationship with any other company. Arm may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any click through or
signed written agreement covering this document with Arm, then the click through or signed written agreement
prevails over and supersedes the conflicting provisions of these terms. This document may be translated into
other languages for convenience, and you agree that if there is any conflict between the English version of this
document and any translation, the terms of the English version of the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited
(or its affiliates) in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this
document may be the trademarks of their respective owners. Please follow Arm's trademark usage guidelines at
http://www.arm.com/company/policies/trademarks.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 3
Building libraries for Windows on Arm 102528
Issue 1.0
(LES-PRE-20349)
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license
restrictions in accordance with the terms of the agreement entered into by Arm and the party that Arm
delivered this document to.
Product Status
The information in this document is Final, that is for a developed product.
Web Address
developer.arm.com
We believe that this document contains no offensive terms. If you find offensive terms in this document, please
email [email protected].
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 4
Building libraries for Windows on Arm 102528
Issue 1.0
Contents
1 Overview ..................................................................................................................................................................... 5
1.1 Before you begin ........................................................................................................................................................... 5
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 4 of 5
Building libraries for Windows on Arm 102528
Issue 1.0
1 Overview
Many libraries written in C and C++ provide binary builds that make them easy to use right away.
However, if a particular library does not provide a binary for your platform you must build the source
yourself before you can use the library.
This guide shows how to use Microsoft Visual Studio to build native Windows on Arm libraries. The
guide uses the specific example of the popular zlib library, but you can apply the techniques to any
library.
The host device must have Visual Studio installed, including the Arm build tools. We show you how to
install Visual Studio in Install Visual Studio.
In this guide, we use the zlib library as an example to show how to compile a library for Windows on
Arm. You must download and unpack the zlib source from www.zlib.net. There are several packaging
options to choose from. In this guide, we use zlib source code version 1.2.11, zip file format.
To use the library on your target Windows on Arm device, you must acquire and install the Microsoft
C Runtime Library, version 14.00.24234.1 or later, called vcruntime140.dll. Microsoft
distributes this runtime library as part of Microsoft Visual C++ Redistributable for Visual Studio
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 5 of 6
Building libraries for Windows on Arm 102528
Issue 1.0
2015, 2017 and 2019, available as vc_redist.arm64.exe. For more information, see this information
from Microsoft: The latest supported Visual C++ downloads.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 7
Building libraries for Windows on Arm 102528
Issue 1.0
For complete installation instructions, see Install Visual Studio in the Microsoft Visual Studio
documentation.
To install Visual Studio, including the Arm build tools, on your x86-based or AMD64/x64-based host
device, follow these steps:
1. Run the downloaded installer by double-clicking
vs_community__719936627.1591007999.exe.
The installation process begins by downloading the required files, as shown in the following
screenshot:
2. Click Desktop development with C++ on the Workloads tab in the Installing – Visual Studio
window, as you can see in the following screenshot:
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 8
Building libraries for Windows on Arm 102528
Issue 1.0
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 9
Building libraries for Windows on Arm 102528
Issue 1.0
We chose zlib to use as an example because it is well known, widely used, and freely available. The zlib
library lets you create and extract zip archives.
<install_dir>\zlib-1.2.11\contrib\vstudio\vc14
This solution file loads several Visual Studio C/C++ project .vcxproj files, located in the same
folder.
2. The first time you open zlibvc.sln, Visual Studio prompts you to upgrade the solution and the
projects so that they build with the latest toolset. Click OK.
When this short task finishes, you have a standard Visual C/C++ project that is ready for work.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 9 of 10
Building libraries for Windows on Arm 102528
Issue 1.0
3. Add a new release configuration for the 64-bit Arm platform, ARM64.
The easiest way to do this is to let the Configuration Manager copy one of the other project
configurations.
a. Select Release > Configuration Manager as shown in the following screenshot:
c. Type ARM64 for the new platform. Copy settings from the existing Win32 platform. Ensure
that the Create new project platforms option is enabled, then click OK as shown in the
following screenshot:
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 11
Building libraries for Windows on Arm 102528
Issue 1.0
d. Unselect all projects except zlibvc, testzlib, and testzlibdll as shown in the following
screenshot:
You can select more projects if you want, but you may need to modify other settings to build them
successfully.
4. Modify the project properties for each of the buildable projects zlibvc, testzlib, and testzlibdll.
Select the project, then click Project > Properties.
All projects Configuration Properties Give each project a unique file name value, for example zlibvc_db
> C/C++
> All Options
> Program Database File Name
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 12
Building libraries for Windows on Arm 102528
Issue 1.0
5. Select the ARM64 Release build configuration by using the Solution Platforms option menus, as
shown in the following screenshot:
There are many similarities between libraries built for Intel, and those for Windows on Arm:
• Just like Intel binaries, Arm binaries have properties, version resources, and all the other
attributes you would expect.
• Libraries may be either static or dynamic.
• The rules about where dynamic link libraries must go are the same on both platforms.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 12 of 13
Building libraries for Windows on Arm 102528
Issue 1.0
One of the projects we built in Build the library is a test program, testzlibdll.exe. When you run
this program, it reports information about its execution.
From the test program output, we can see that the Arm64 executable is working correctly.
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 13 of 14
Building libraries for Windows on Arm 102528
Issue 1.0
5 Related information
Here are some resources related to material in this guide:
• Building ARM64 Win32 C++ Apps on YouTube
• Microsoft resources:
o Install Visual Studio
o Microsoft Visual Studio documentation
o The latest supported Visual C++ downloads
o Visual Studio on Arm-powered devices
o visualstudio.microsoft.com
o Windows 10 on Arm documentation
• Windows on Arm
• zlib.net
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 14 of 15
Building libraries for Windows on Arm 102528
Issue 1.0
6 Next steps
This guide showed you how to use Microsoft Visual Studio to compile and build the zlib library for
Windows on Arm devices.
As we have seen, building existing C and C++ code for Windows on Arm is not difficult. If you have any
code that uses processor-specific features, you must rewrite that code before proceeding. Otherwise,
porting to Arm is usually as simple as installing the Visual Studio tooling and adding new build targets.
You can apply the same process and techniques to build any library for Windows on Arm.
As a next step, you could try building a different library for Windows on Arm. You could also try an
open-source library, or create a library of your own.
You can also examine other libraries that have been ported to Windows on Arm. Here are some
examples:
• iconv
• libxml2
• LZMA
Copyright © 2021 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 15 of 15