Linking C libraries with DMD

Dibyendu Majumdar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 14:35:29 PST 2016


On Thursday, 21 January 2016 at 22:23:36 UTC, jmh530 wrote:
> Thanks. I had been trying to get 32bit code to work. I don't 
> think I did anything special with gcc to compile the dll as 
> 64bit. Anyway, this is what I get when I try it again (stuff in 
> brackets I replaced).
>
> C:<folder>>dmd -m64 <file>.d -L/LIBPATH:C:<folder> 
> -L//IMPLIB:<libfile>.lib
> LINK : warning LNK4044: unrecognized option 
> '//IMPLIB:<libfile>.lib'; ignored
> callC0.obj : error LNK2019: unresolved external symbol 
> <cfunction> referenced in f
> unction _Dmain
> callC0.exe : fatal error LNK1120: 1 unresolved externals
> --- errorlevel 1120

Sorry the option should be -L/IMPLIB:.. - with single slash but 
you only need this if you are trying to create a shared library 
which presumably you are not?

I believe to create a static library you need to use -lib, else 
it is an app so you need to supply a main function.

Regards



More information about the Digitalmars-d-learn mailing list