How to use library compiled with Microsoft Visual Studio 2015 in D?

unDEFER via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 5 00:02:38 PST 2016


On Monday, 5 December 2016 at 07:21:30 UTC, Jacob Carlborg wrote:
> If you compile your D code with the "-m32mscoff" flag it will 
> produce COFF objects and use the Visual Studio tool chain 
> (linker and runtime). Compiling for 64bit (-m64) will always 
> produce COFF objects.

Big thanks! -m32mscoff is great!
But now I have the problem of unresolved external symbols, e.g. 
"__imp__htonl at 4".
What I'm doing? I'm going to Microsoft Visual Studio directory 
and run the script:
$ for i in `/bin/find.exe . -iname "*.lib"`; do bin/dumpbin 
/SYMBOLS $i | /bin/grep __imp__htonl at 4 && echo $i; done
308 00000000 UNDEF  notype       External     | __imp__htonl at 4
./atlmfc/lib/nafxcw.lib
3C6 00000000 UNDEF  notype       External     | __imp__htonl at 4
./atlmfc/lib/nafxcwd.lib
332 00000000 UNDEF  notype       External     | __imp__htonl at 4
./atlmfc/lib/uafxcw.lib
3D6 00000000 UNDEF  notype       External     | __imp__htonl at 4
./atlmfc/lib/uafxcwd.lib

Try to link with found libraries, but it doesn't work. The 
symbols still unresolved.
What I'm doing wrong?


More information about the Digitalmars-d-learn mailing list