Completely Remove C Runtime with DMD for win32

tcb tcb at pleasenoemailspam.net
Sun Jul 15 20:29:29 UTC 2018


I've been trying to compile a trivial program (extern C int 
main() {return 0;}) without linking parts of the C runtime with 
no success.

I compile with dmd -debuglib= -defaultlib= -v -L=/INFORMATION 
-betterC but optlink shows a lot of things from snn.lib being 
pulled in and the resultant executable is about 12kb. I also 
replaced object.d with an empty module.

If I pass /nodefaultlib to the linker I get warning 23: no stack 
and __acrtused_con is undefined so the linker fails with no start 
address.

Is it possible to completely remove the C runtime on windows, and 
if so how? Sorry for the sloppily formatted post.


More information about the Digitalmars-d mailing list