How to deploy single exe application (?)
Willem
willem at matimba.com
Sun Nov 28 22:45:29 UTC 2021
On Sunday, 28 November 2021 at 16:12:42 UTC, Imperatorn wrote:
>
> Did you try the import solution?
I think so ... below is my test program.
It executes OK - but it is not using the imported libcurl dll.
Many Thanks.
========== app.d ============
```
import std.stdio;
import std.uuid;
import std.file;
import std.path;
import std.string;
import derelict.sdl2.sdl;
ubyte[] sdlBytes = cast(ubyte[]) import("SDL2.dll");
ubyte[] curlBytes = cast(ubyte[]) import("libcurl.dll");
void main(string[] args)
{
// load sdl
string uuid = randomUUID().toString();
string filename = format("SDL2-%s.dll", uuid);
string depacked = buildPath(tempDir(), filename);
std.file.write(depacked, sdlBytes);
DerelictSDL2.load(depacked);
// load curl
string uuid2 = randomUUID().toString();
string filename2 = format("libcurl-%s.dll", uuid2);
string depacked2 = buildPath(tempDir(), filename2);
std.file.write(depacked2, curlBytes);
DerelictSDL2.load(depacked2);
// test curl
import std.net.curl;
auto content = get("https://httpbin.org/get");
writeln(content);
writeln("..DONE");
}
```
========== dub.json ============
```
{
"dependencies": {
"derelict-sdl2": "~>2.1.4"
},
"name": "add-sdl",
"stringImportPaths": ["./dll"]
}
```
More information about the Digitalmars-d-learn
mailing list