Bug 16063 – DLL projects seem to ignore DllMain, won't link

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-05-23T03:03:00Z
Last change time
2017-01-24T08:07:44Z
Assigned to
nobody
Creator
turkeyman

Comments

Comment #0 by turkeyman — 2016-05-23T03:03:08Z
I create a DLL project: Properties -> General -> Output Type = DLL, Subsystem = Windows I get the error when linking: error LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) Seems to want WinMain, even though it's a DLL. If I change 'Subsystem' to 'Not Set', it complains that main() is missing instead.
Comment #1 by turkeyman — 2016-05-23T03:08:54Z
Seems that it expects '/DLL' given to the linker, but it's not. I added -L/DLL to additional options and it links. This should probably be there automatically.
Comment #2 by r.sagitario — 2016-05-24T19:46:55Z
I noticed this too recently. This only happens when using the MS linker (also for 32-bit DLLs), not with optlink.
Comment #3 by turkeyman — 2016-05-26T12:36:01Z
Ah, I don't think I've ever used optlink since your 32bit COFF work was merged ;)
Comment #4 by r.sagitario — 2017-01-24T08:07:44Z