www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13431] New: pragma(startaddress) doesn't work with COFF

https://issues.dlang.org/show_bug.cgi?id=13431

          Issue ID: 13431
           Summary: pragma(startaddress) doesn't work with COFF
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

I don't know if the COFF object file format supports indicating the entry
point, but if it does, then DMD does not emit this information when
pragma(startaddress) is used.

Example program:

////////// test.d //////////
import win32.winbase;

void start()
{
    ExitProcess(0);
}

pragma(startaddress, start);
////////////////////////////

When compiling with -m64 or -m32mscoff, the linker complains:

LINK : fatal error LNK1561: entry point must be defined

--
Sep 06 2014