Differences From Artifact [cc2ab2b91c87057b]:
- File
src/testexe.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
To Artifact [e4521a091f44ac97]:
- File
src/testexe.d
- 2015-05-05 06:54:57 - part of checkin [57ea797fa4] on branch trunk - Correct fix for std file handle closing issue. (user: kinaba) [annotate]
3 3 import std.string;
4 4 import core.runtime;
5 5
6 6 alias extern(Windows) int function( HWND a, immutable char* b, char* c, DWORD d ) CmdFuncT;
7 7
8 8 void main()
9 9 {
10 - HINSTANCE h = cast(HINSTANCE) Runtime.loadLibrary("QBga32.DLL");
11 10 for(;;) {
12 11 write("> ");
13 12 string s = readln();
14 13 if(s.length > 0) {
14 + HINSTANCE h = cast(HINSTANCE) Runtime.loadLibrary("QBga32.DLL");
15 15 CmdFuncT Bga = cast(CmdFuncT)GetProcAddress(h, "Bga");
16 16 int r = Bga(NULL, s.toStringz(), null, 0);
17 + Runtime.unloadLibrary(h);
17 18 writeln("Return: ", r);
18 19 }
19 20 }
20 - Runtime.unloadLibrary(h);
21 21 }