digitalmars.D.learn - How to use library compiled with Microsoft Visual Studio 2015 in D?
- unDEFER (16/16) Dec 04 2016 Hello! I have compiled libdb (BerkeleyDB) with Microsoft Visual
- Jacob Carlborg (6/22) Dec 04 2016 If you compile your D code with the "-m32mscoff" flag it will produce
Hello! I have compiled libdb (BerkeleyDB) with Microsoft Visual Studio 2015. 1) "Debug" mode. I have libdb53d.dll file. Do implib. The linker doesn't seen symbols from the library! Do "lib -l". In the list of symbols "db_create", linker searches "_db_create". Is it the problem? 2) "Debug-Static" mode. I have libdb53d.lib file. Try to compile. linker say that it has unsupported COFF format. Read about COFF2OMF, buy extended utils to get it. $ coff2omf libdb53d.lib Segmentation Fault Try like on page http://www.digitalmars.com/ctg/coff2omf.html: $ link /lib /convert file.lib LINK : warning LNK4044: unrecognized option '/convert'; ignored So nothing works. How to use a library compiled with Microsoft Visual Studio 2015 in D?
Dec 04 2016
On 2016-12-05 07:44, unDEFER wrote:Hello! I have compiled libdb (BerkeleyDB) with Microsoft Visual Studio 2015. 1) "Debug" mode. I have libdb53d.dll file. Do implib. The linker doesn't seen symbols from the library! Do "lib -l". In the list of symbols "db_create", linker searches "_db_create". Is it the problem? 2) "Debug-Static" mode. I have libdb53d.lib file. Try to compile. linker say that it has unsupported COFF format. Read about COFF2OMF, buy extended utils to get it. $ coff2omf libdb53d.lib Segmentation Fault Try like on page http://www.digitalmars.com/ctg/coff2omf.html: $ link /lib /convert file.lib LINK : warning LNK4044: unrecognized option '/convert'; ignored So nothing works. How to use a library compiled with Microsoft Visual Studio 2015 in D?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. -- /Jacob Carlborg
Dec 04 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 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 4 && echo $i; done 308 00000000 UNDEF notype External | __imp__htonl 4 ./atlmfc/lib/nafxcw.lib 3C6 00000000 UNDEF notype External | __imp__htonl 4 ./atlmfc/lib/nafxcwd.lib 332 00000000 UNDEF notype External | __imp__htonl 4 ./atlmfc/lib/uafxcw.lib 3D6 00000000 UNDEF notype External | __imp__htonl 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?
Dec 05 2016
OK, I have found. It must be library WS2_32.LIB from Microsoft SDK. But dumpbin doesn't show __imp__htonl 4 symbol there. The magic! Thank you!
Dec 05 2016