Artifact cc2ab2b91c87057b3522028258f6b9806ee4df71:
- 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.
0000: 69 6d 70 6f 72 74 20 77 69 6e 33 32 2e 77 69 6e import win32.win
0010: 64 6f 77 73 3b 0a 69 6d 70 6f 72 74 20 73 74 64 dows;.import std
0020: 2e 73 74 64 69 6f 3b 0a 69 6d 70 6f 72 74 20 73 .stdio;.import s
0030: 74 64 2e 73 74 72 69 6e 67 3b 0a 69 6d 70 6f 72 td.string;.impor
0040: 74 20 63 6f 72 65 2e 72 75 6e 74 69 6d 65 3b 0a t core.runtime;.
0050: 0a 61 6c 69 61 73 20 65 78 74 65 72 6e 28 57 69 .alias extern(Wi
0060: 6e 64 6f 77 73 29 20 69 6e 74 20 66 75 6e 63 74 ndows) int funct
0070: 69 6f 6e 28 20 48 57 4e 44 20 61 2c 20 69 6d 6d ion( HWND a, imm
0080: 75 74 61 62 6c 65 20 63 68 61 72 2a 20 62 2c 20 utable char* b,
0090: 63 68 61 72 2a 20 63 2c 20 44 57 4f 52 44 20 64 char* c, DWORD d
00a0: 20 29 20 43 6d 64 46 75 6e 63 54 3b 0a 0a 76 6f ) CmdFuncT;..vo
00b0: 69 64 20 6d 61 69 6e 28 29 0a 7b 0a 09 48 49 4e id main().{..HIN
00c0: 53 54 41 4e 43 45 20 68 20 3d 20 63 61 73 74 28 STANCE h = cast(
00d0: 48 49 4e 53 54 41 4e 43 45 29 20 52 75 6e 74 69 HINSTANCE) Runti
00e0: 6d 65 2e 6c 6f 61 64 4c 69 62 72 61 72 79 28 22 me.loadLibrary("
00f0: 51 42 67 61 33 32 2e 44 4c 4c 22 29 3b 0a 09 66 QBga32.DLL");..f
0100: 6f 72 28 3b 3b 29 20 7b 0a 09 09 77 72 69 74 65 or(;;) {...write
0110: 28 22 3e 20 22 29 3b 0a 09 09 73 74 72 69 6e 67 ("> ");...string
0120: 20 73 20 3d 20 72 65 61 64 6c 6e 28 29 3b 0a 09 s = readln();..
0130: 09 69 66 28 73 2e 6c 65 6e 67 74 68 20 3e 20 30 .if(s.length > 0
0140: 29 20 7b 0a 09 09 09 43 6d 64 46 75 6e 63 54 20 ) {....CmdFuncT
0150: 42 67 61 20 3d 20 63 61 73 74 28 43 6d 64 46 75 Bga = cast(CmdFu
0160: 6e 63 54 29 47 65 74 50 72 6f 63 41 64 64 72 65 ncT)GetProcAddre
0170: 73 73 28 68 2c 20 22 42 67 61 22 29 3b 0a 09 09 ss(h, "Bga");...
0180: 09 69 6e 74 20 72 20 3d 20 42 67 61 28 4e 55 4c .int r = Bga(NUL
0190: 4c 2c 20 73 2e 74 6f 53 74 72 69 6e 67 7a 28 29 L, s.toStringz()
01a0: 2c 20 6e 75 6c 6c 2c 20 30 29 3b 0a 09 09 09 77 , null, 0);....w
01b0: 72 69 74 65 6c 6e 28 22 52 65 74 75 72 6e 3a 20 riteln("Return:
01c0: 22 2c 20 72 29 3b 0a 09 09 7d 0a 09 7d 0a 09 52 ", r);...}..}..R
01d0: 75 6e 74 69 6d 65 2e 75 6e 6c 6f 61 64 4c 69 62 untime.unloadLib
01e0: 72 61 72 79 28 68 29 3b 0a 7d 0a rary(h);.}.