[dmd-beta] dmd 1.070 and 2.055 beta

Brad Roberts braddr at puremagic.com
Tue Sep 6 15:07:29 PDT 2011


On Tue, 6 Sep 2011, Rainer Schuetze wrote:

> On 06.09.2011 23:05, Rainer Schuetze wrote:
> A simple example is this:
> 
> module dllmain;
> import std.c.windows.windows;
> 
> int test;
> 
> extern (Windows)
> BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
> {
>     test = 1;
>     return true;
> }
> 
> to be compiled with
> dmd -g -v -oftest.dll dll.def -L/SUBSYSTEM:WINDOWS dllmain.d
> 
> 
> The problem is, that backend_init() is called before the files on the command
> line are processed. So, global.params.deffile is always 0 when config.wflags
> is set in out_config_init(), and the code generation thinks it is generating
> an executable.
> 
> Though unused by dmd, the deffile looks like this for completeness:
> LIBRARY "test.dll"
>  EXETYPE NT
>  SUBSYSTEM WINDOWS
>  CODE SHARED EXECUTE
>  DATA WRITE
> 

Damn.. that one would be my changes then.  If the choice is to revert then 
the fix to iasm.d that depends on the changes to backend_init will also 
need to be reverted (also re-opening the closed bug associated with it).

I'm not in a good position to spend much time digging into this right now, 
but on quick inspection of the code, in mars.c, try moving the call of 
backend_init to after the module creation loop, before the try.

-------------- next part --------------
_______________________________________________
dmd-beta mailing list
dmd-beta at puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta


More information about the dmd-beta mailing list