Linking C libraries with DMD

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 14:23:36 PST 2016


On Thursday, 21 January 2016 at 22:14:25 UTC, Dibyendu Majumdar 
wrote:
> On Thursday, 21 January 2016 at 22:09:47 UTC, jmh530 wrote:
>> The -L/LIBPATH:c:\lib gives me an error that
>> OPTLINK : Warning 9: Unknown Option : LIBPATH
>> and then gives the path I put is not found.
>>
>> At least when it's outputting the text, it's combining
>> :C:\lib\yourlib.lib
>> so it seemingly is finding it.
>
> OPTLINK is for 32-bit code - the options I showed are for 
> 64-bit, which uses MS LINK. You get 64-bit code by adding -m64.
>
> Regards

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



More information about the Digitalmars-d-learn mailing list