I'm trying to create a super simple dynamic library consisting of two files:


 ------------ file2.d ----------------------
extern(D):
    double addEight(double d) { return (d + 8.0); }
        
------------ fileB.d ----------------------
extern(D)
{
    string concatSuffix(string s) { return (s ~ ".ext"); }
}


dmd -m64 -c file2.d
dmd -m64 -c fileB.d
creates file2.obj and fileB.obj files

link.exe /DLL /NOENTRY file2.obj fileB.obj msvcrt.lib

fileB.obj : error LNK2019: unresolved external symbol _D12TypeInfo_Aya6__initZ referenced in function _D5fileB12concatPrefixFAyaZQe fileB.obj : error LNK2019: unresolved external symbol _d_arraycatT referenced in function _D5fileB12concatPrefixFAyaZQe

Ok. I find _d_arraycatT in the D website at:

https://dlang.org/library/rt/lifetime/_d_arraycat_t.html

So I thought, this symbol will be in phobos64.lib. But when I add it to the command, all hell breaks loose:


link.exe /DLL /NOENTRY file2.obj fileB.obj msvcrt.lib phobos64.lib

phobos64.lib(bits_23fa_21c.obj) : error LNK2001: unresolved external symbol memcpy
 o  o  o
file2.dll : fatal error LNK1120: 57 unresolved externals


So I'm stuck and don't have a clue as to how to continue.

I thought Phobos64.lib was self-contained. Do I need to add other libraries? And how do I know which ones?




Reply via email to