cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Compiling libcurl staticly within DLL-module with mingw32

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Sat, 20 Aug 2011 14:26:34 +0200

"Alexander Tumin" <itakingiteasy_at_gmail.com> wrote:

> As you can see in Makefile; module.c is compiled twice:
> * once linked staticly with libstatic_curl.a and
> * once linked dynamicly with libcurl-4.dll
>
> There is no problems with dynamic build - it just works perfectly as expected.
>
> The problem is that when it is linked staticly: all module's symbols
> becomes completely inaccessible with
> GetProcAddress() function from <windows.h> - it just returns NULL for anything.

A "static" DLL is a self-contradiction. At least when you build it like this:

module_static.dll: module.c
 $(CC) -L . -shared module.c -o module_static.dll -DCURL_STATICLIB libstatic_curl.a -lws2_32

module_static.dll will have nothing to export because of 'CURL_STATICLIB'. I.e.
'CURL_EXTERN' in <curl/curl.h> is not '__declspec(dllimport)' as is required when
using libcurl dynamically.

Verify this with 'pedump module_static.dll' and 'depends'.

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-20