1 2 3 ___ __ _ _ __ ___ ___ 4 / __| ___ / _` | '__/ _ \/ __| 5 | (_ |___| (_| | | | __/\__ \ 6 \___| \__,_|_| \___||___/ 7 8 9 How to build c-ares using MSVC or Visual Studio 10 ================================================= 11 12 13 14 How to build using MSVC from the command line 15 --------------------------------------------- 16 17 Open a command prompt window and ensure that the environment is properly 18 set up in order to use MSVC or Visual Studio compiler tools. 19 20 Change to c-ares source folder where Makefile.msvc file is located and run: 21 22 > nmake -f Makefile.msvc 23 24 This will build all c-ares libraries as well as three sample programs. 25 26 Once the above command has finished a new folder named MSVCXX will exist 27 below the folder where makefile.msvc is found. The name of the folder 28 depends on the MSVC compiler version being used to build c-ares. 29 30 Below the MSVCXX folder there will exist four folders named 'cares', 31 'ahost', 'acountry', and 'adig'. The 'cares' folder is the one that 32 holds the c-ares libraries you have just generated, the other three 33 hold sample programs that use the libraries. 34 35 The above command builds four versions of the c-ares library, dynamic 36 and static versions and each one in release and debug flavours. Each 37 of these is found in folders named dll-release, dll-debug, lib-release, 38 and lib-debug, which hang from the 'cares' folder mentioned above. Each 39 sample program also has folders with the same names to reflect which 40 library version it is using. 41 42 43 How to install using MSVC from the command line 44 ----------------------------------------------- 45 46 In order to allow easy usage of c-ares libraries it may be convenient to 47 install c-ares libraries and header files to a common subdirectory tree. 48 49 Once that c-ares libraries have been built using procedure described above, 50 use same command prompt window to define environment variable INSTALL_DIR 51 to designate the top subdirectory where installation of c-ares libraries and 52 header files will be done. 53 54 > set INSTALL_DIR=c:\c-ares 55 56 Afterwards, run following command to actually perform the installation: 57 58 > nmake -f Makefile.msvc install 59 60 Installation procedure will copy c-ares libraries to subdirectory 'lib' and 61 c-ares header files to subdirectory 'include' below the INSTALL_DIR subdir. 62 63 When environment variable INSTALL_DIR is not defined, installation is done 64 to c-ares source folder where Makefile.msvc file is located. 65 66 67 68 Relationship between c-ares library file names and versions 69 ----------------------------------------------------------- 70 71 c-ares static release library version files: 72 73 libcares.lib -> static release library 74 75 c-ares static debug library version files: 76 77 libcaresd.lib -> static debug library 78 79 c-ares dynamic release library version files: 80 81 cares.dll -> dynamic release library 82 cares.lib -> import library for the dynamic release library 83 cares.exp -> export file for the dynamic release library 84 85 c-ares dynamic debug library version files: 86 87 caresd.dll -> dynamic debug library 88 caresd.lib -> import library for the dynamic debug library 89 caresd.exp -> export file for the dynamic debug library 90 caresd.pdb -> debug symbol file for the dynamic debug library 91 92 93 How to use c-ares static libraries 94 ---------------------------------- 95 96 When using the c-ares static library in your program, you will have to 97 define preprocessor symbol CARES_STATICLIB while building your program, 98 otherwise you will get errors at linkage stage. 99 100 101Have Fun! 102 103