Entry point errors when using LDC to compile Windows Subsystem module with -m32

kinke noone at nowhere.com
Thu Sep 20 21:11:52 UTC 2018


On Thursday, 20 September 2018 at 20:48:50 UTC, spikespaz wrote:
> When comping with the command below, I get linker errors saying 
> that '/SUBSYSTEM:WINDOWS" isn't recognized and is ignored

Then you're most likely accidentally using DMD's link.exe. When 
using a multilib LDC build on Win64 and cross-compiling to Win32, 
the IMO simplest way is to spawn a new naked cmd.exe shell with 
untainted PATH and let LDC detect the Visual Studio installation 
(and the 32-bit lib dirs).

On my system:

extern (Windows) int WinMain() { return 0; }

ldc2 -L/SUBSYSTEM:WINDOWS -m32:
error LNK2019: unresolved external symbol _WinMain at 16 referenced 
in function "int __cdecl __scrt_common_main_seh(void)" 
(?__scrt_common_main_seh@@YAHXZ)

It's working with proper signature [1]:

extern (Windows) int WinMain(void* hInstance, void* 
hPrevInstance, void* lpCmdLine, int nCmdShow) { return 0; }

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633559(v=vs.85).aspx


More information about the Digitalmars-d-learn mailing list