On Monday, 29 November 2021 at 07:29:35 UTC, Mike Parker wrote:
`DerelictSDL2.load()` cannot load curl. It is not a generic dll
loader. It only loads SDL and doesn't know anything about curl
or any other library.
In order to dynamically load curl like this, you need a binding
that supports it, i.e., a binding that declares the curl API as
function pointers and knows how to load them from the DLL.
Also, DerelictSDL2 is no longer maintained. Please use
bindbc-sdl for new projects:
http://bindbc-sdl.dub.pm/
Thanks again for all the responses. For now -- I am simply adding
the DLL to the EXE and writing it out to the working directory.
Not elegant - but it does work.
```
import std.stdio;
import std.file;
ubyte[] curlBytes = cast(ubyte[]) import("libcurl.dll");
void main(string[] args)
{
std.file.write("libcurl.dll", curlBytes);
// test curl
import std.net.curl;
auto content = get("https://httpbin.org/get");
writeln(content);
writeln("..DONE");
}
```