digitalmars.D - D not able to link .o files
- meldolion (9/9) Feb 25 2008 I tried to include a external c function created by MinGW in a D source.
- Tim Healey (4/18) Feb 25 2008 Different compilers use different object formats. It would probably be
- Bill Baxter (18/36) Feb 25 2008 BTW, if you got your DMD installation from DigitalMars.com (and not from...
- Jacob Carlborg (2/9) Feb 25 2008 I have never seen implib in either the dmd zip or dmc
- Bill Baxter (12/22) Feb 25 2008 Oops. Maybe you need to get the "Basic Utilities Package" then.
- Jacob Carlborg (2/29) Feb 25 2008 There they are, that will make a lot of things easier :)
I tried to include a external c function created by MinGW in a D source. so I got a helloworld.o file when i want to compile my main.d module with following command: dmd main.d helloworld.o I get the error Error: unrecognized file extension o How can I solve that problem thx for help meldolion
Feb 25 2008
meldolion wrote:I tried to include a external c function created by MinGW in a D source. so I got a helloworld.o file when i want to compile my main.d module with following command: dmd main.d helloworld.o I get the error Error: unrecognized file extension o How can I solve that problem thx for help meldolionDifferent compilers use different object formats. It would probably be easier to either compile the C program with Digital Mars C and continue using DMD or compile the D program with GDC and continue using MinGW.
Feb 25 2008
Tim Healey wrote:meldolion wrote:BTW, if you got your DMD installation from DigitalMars.com (and not from the Tango folks) then you already have a copy of "dmc" the DigitalMars C++ compiler. Additionally, one way to get around the object file differences is to build a DLL, since the DLL format is standardized. Given a MinGW library called libThing.a you can build a shared lib with a crazy command line like this: gcc -mno-cygwin -shared -o Thing.dll \ -Wl,--out-implib=Thing_mingw.lib \ -Wl,--export-all-symbols -Wl,--allow-multiple-definition \ -Wl,--enable-auto-import -Wl,--whole-archive libThing.a \ -Wl,--no-whole-archive [libs libThing uses internally] That'll create Thing.dll and an import lib called Thing_mingw.lib. Ignore Thing_mingw.lib, and create a new DMD-compatible import lib using: implib /system Thingdll.lib Thing.dll (implib should be in the dm/bin dir) --bbI tried to include a external c function created by MinGW in a D source. so I got a helloworld.o file when i want to compile my main.d module with following command: dmd main.d helloworld.o I get the error Error: unrecognized file extension o How can I solve that problem thx for help meldolionDifferent compilers use different object formats. It would probably be easier to either compile the C program with Digital Mars C and continue using DMD or compile the D program with GDC and continue using MinGW.
Feb 25 2008
Bill Baxter wrote:That'll create Thing.dll and an import lib called Thing_mingw.lib. Ignore Thing_mingw.lib, and create a new DMD-compatible import lib using: implib /system Thingdll.lib Thing.dll (implib should be in the dm/bin dir) --bbI have never seen implib in either the dmd zip or dmc
Feb 25 2008
Jacob Carlborg wrote:Bill Baxter wrote:Oops. Maybe you need to get the "Basic Utilities Package" then. I should read my README.txt more closely next time ;-). There I clearly state: """ Next you need to create a D-compatible import lib from that using 'implib' in the "Basic Utilties Package": http://www.digitalmars.com/download/freecompiler.html --> http://ftp.digitalmars.com/bup.zip """ :-) --bbThat'll create Thing.dll and an import lib called Thing_mingw.lib. Ignore Thing_mingw.lib, and create a new DMD-compatible import lib using: implib /system Thingdll.lib Thing.dll (implib should be in the dm/bin dir) --bbI have never seen implib in either the dmd zip or dmc
Feb 25 2008
Bill Baxter wrote:Jacob Carlborg wrote:There they are, that will make a lot of things easier :)Bill Baxter wrote:Oops. Maybe you need to get the "Basic Utilities Package" then. I should read my README.txt more closely next time ;-). There I clearly state: """ Next you need to create a D-compatible import lib from that using 'implib' in the "Basic Utilties Package": http://www.digitalmars.com/download/freecompiler.html --> http://ftp.digitalmars.com/bup.zip """ :-) --bbThat'll create Thing.dll and an import lib called Thing_mingw.lib. Ignore Thing_mingw.lib, and create a new DMD-compatible import lib using: implib /system Thingdll.lib Thing.dll (implib should be in the dm/bin dir) --bbI have never seen implib in either the dmd zip or dmc
Feb 25 2008