Compiling and linking libcurl to create a stand alone dll

Posted by Haraldo on Stack Overflow See other posts from Stack Overflow or by Haraldo
Published on 2010-04-15T23:37:25Z Indexed on 2010/04/15 23:43 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

Hi, I've managed to compile a dll with the necessary linked libraries (*.lib) and with CURL_STATICLIB set in the preprocessor section among other settings.

I'm using "libcurl-7.19.3-win32-ssl-msvc.zip" package and compiling with VS 2008 express. This has been the first version I managed to get compiled properly with no link issues etc.

The problem I have now is that my dll needs libcurl.dll to function and this is not ok. My dll needs to be independent.

I have no idea how to implement this. I've taken all day just to get what I've got compiled.

  • I've got runtime library set to Multi threaded dll (debug/release) respectively under C/C++ -> code generation.
  • I've a number of preprocessor set - CURL_STATICLIB being one of them.
  • Configuration Type is set to Dynamic Library
  • Use of MFC is set to Use MFC in a static library
  • Additional Library Directories is set to the lib folders (debug/release) respectively.

I've noticed there is a curllib_static.lib file which I've tried instead of curllib.lib as an additional dependency but it only compiles with the later. This is driving me nuts!

So I guess I need some guidance as to how to make my dll completely static so it doesn't have any dependencies. I notice my dll is currently dependent on:

  • CURLLIB.DLL
  • MSVCR90D.DLL

As I'm pretty new to C++ it could be a setting I'm missing in VS 2008 but I'm not sure. One person said I should be using a static library with *.a files (libcurl.a) etc but when I do this I get link errors which I haven't been able to resolve. Any guidance here would be much appreciated.

© Stack Overflow or respective owner

Related posts about vs2008

Related posts about c++