initial load of upstream version 1.06.32
[xmlrpc-c] / Windows / UsingCURLinWin32.txt
1 Background:
2 Let\92s say you need to support a xmlrpc-c client running as a service.  In this
3 situation you cannot use WinInet.  Details of the restriction can be found on
4 the libcurl website or various Microsoft KB articles.  The alternative is to use
5 libcurl.  This document describes the steps required to use libcurl as your
6 transport mechanism as supported by the latest files and projects provided in
7 the xmlrpc-c distribution.  The assumption is that you can successfully compile
8 the distribution of xmlrpc-c.
9
10 Overview:
11 The default projects in xmlrpc-c create standalone executables that do not
12 require other DLL\92s (release mode).  While the case can be made for this
13 behavior pro and con, it is beyond this document to justify it.  Therefore, we
14 need to create static link libraries for libcurl that mimics this behavior. 
15 Once the link libraries are created, we can then add them (plus the requisite
16 curl headers) into the xmlrpc-c project.  Finally, we enable the compilation of
17 the curl transport file and tell xmlrpc-c that we will be using curl.  Lastly,
18 we build and test the project.
19
20 Steps to use CURL with Win32 xmlrpc-c:
21 1. Download the CURL source.  In the \93include\94 folder of the CURL distribution,
22 copy the curl directory to the \93lib\94 directory of xmlbpc-c.  When you are done
23 with this step, you should have a curl.h file located in the directory
24 xmlrpc-c\lib\curl\.  The xmlrpc project looks in this relative path for the
25 necessary headers.
26
27 2. In the CURL distribution, lib directory, is a file called Makefile.vc6.  Edit
28 this file.  The line starting with CCNODBG should be changed to:
29 CCNODBG    = cl.exe /MT /O2 /DNDEBUG
30 The /MT option links with the Multithreaded non-dll version of the c runtime. 
31 If this change is not made, the project will not link, as this is the default
32 setting for the xmlrpc-c projects.  In debug mode, we use the dll version of the
33 c runtime as it makes memory leak checking tools work better.
34
35 3. Open a command prompt window and run the vcvars32.bat file in your Visual C++
36 distribution.  If you are using Studio 2002 or 2003, use the \93Visual Studio
37 Command Prompt\94 from the Start menu to open the console.
38
39 4. Compile release and debug mode libraries.  For the purposes of this tutorial,
40 we are going to build only the curl library without ssl or zlib support.  In the
41 command prompt, navigate to the curl\lib directory and execute the following
42 commands:
43 nmake -f Makefile.vc6 CFG=debug
44 nmake -f Makefile.vc6 CFG=release
45
46 5. The above step should have generated two static link libraries in the
47 curl\lib directory: libcurl.lib and libcurld.lib.  Copy these files into the
48 root of the xmlrpc-c\lib\ directory.  This step ends our involvement with the
49 actual CURL distribution.  The remainder of the steps are for XMLRPC-C.
50
51 6. Open the xmlrpc-c Visual Studio workspace (Instructions for VC++ 6, other
52 versions are slightly different).  In File View, expand the xmlrpc project. 
53 Under \93Source Files\94 there is an entry for xmlrpc_curl_transport.c  This is not
54 included in any build paths by default.  To enable it for compilation, right
55 click the file to change the settings.  In the dropdown, select \93All
56 Configurations.\94  Pick the General tab and uncheck the \93Exclude File From Build\94
57 setting.  Press OK to save your changes to the project.
58
59 7.  In the \93Header Files\94 section of the xmlrpc project is a file called
60 \93transport_config.h\94.  Edit this file to set the MUST_BUILD_CURL_CLIENT to 1,
61 and if you wish to change the default transport to curl, change the
62 XMLRPC_DEFAULT_TRANSPORT to \93curl\94
63
64 8. Compile and test one or more of the sample client projects.