[Issue 20690] New: Static LibCurl
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 21 07:37:26 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20690
Issue ID: 20690
Summary: Static LibCurl
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: svnpenn at gmail.com
It seems it is not current possible to statically link LibCurl. I compiled my
own:
~~~
git clone --depth 1 git://github.com/curl/curl
cd curl
mingw32-make -C lib -f Makefile.m32
~~~
but it fails with `std.net.curl`:
~~~
$ cat std_net_curl.d
import std.net.curl;
void main() {
auto s1 = "http://speedtest.lax.hivelocity.net";
s1.get;
}
$ ldc2 std_net_curl.d wldap32.lib libcurl.lib
$ ./std_net_curl
std.net.curl.CurlException at std\net\curl.d(4223): Failed to load curl, tried
"libcurl.dll", "curl.dll".
~~~
and it fails with `etc.c.curl`:
~~~
$ cat etc_c_curl.d
import etc.c.curl;
void main() {
curl_easy_init();
}
$ ldc2 etc_c_curl.d wldap32.lib libcurl.lib
lld-link: error: libcurl.lib(easy.o): invalid symbol index in addrsig section
~~~
looking at the code, it seems the problem is here:
~~~
alias loadSym = GetProcAddress;
~~~
<https://github.com/dlang/phobos/blob/d5dc0115/std/net/curl.d#L4194>
I am not an expert, but I think `GetProcAddress` is for working with DLL, not
static libraries:
<https://docs.microsoft.com/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress>
--
More information about the Digitalmars-d-bugs
mailing list