www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Produce some COFF object with 2.066 ?

reply "Baz" <basile.burg gmx.com> writes:
Hello, I've been very interested about the announce saying that 
DMD is able to produce COFF object files. Mostly because I'm 
thinking using some objects programmed in D in a software 
programmed in another lang, a bit like when statically linking a 
dll to a program but with an obj, to keep a nice monolithic 
executable.

First thing: I've tried a simple thing: compile an exported 
function with the args "myfile.d -c -ms32mscoff" and dmd 
complains that "-ms32mscoff" is not a recognized switch.

Second thing:
If I understand well, it means that previously, to link D a 
object with a soft programmed in another lang was not possible 
because the OMF objs don't include everything (e.g the objs 
coming from other imported static libs) and that now it's 
faisable ?  right ?
Aug 20 2014
parent "Brad Anderson" <eco gnuk.net> writes:
On Wednesday, 20 August 2014 at 23:56:23 UTC, Baz wrote:
 Hello, I've been very interested about the announce saying that 
 DMD is able to produce COFF object files. Mostly because I'm 
 thinking using some objects programmed in D in a software 
 programmed in another lang, a bit like when statically linking 
 a dll to a program but with an obj, to keep a nice monolithic 
 executable.

 First thing: I've tried a simple thing: compile an exported 
 function with the args "myfile.d -c -ms32mscoff" and dmd 
 complains that "-ms32mscoff" is not a recognized switch.
32-bit COFF is only in git master currently. It'll be in 2.067 when that comes out. 64-bit COFF has been in dmd for quite some time now. You just have to have a copy of Visual Studio installed (the free Express edition should be fine) and compile with -m64.
 Second thing:
 If I understand well, it means that previously, to link D a 
 object with a soft programmed in another lang was not possible 
 because the OMF objs don't include everything (e.g the objs 
 coming from other imported static libs) and that now it's 
 faisable ?  right ?
They'd just have to both be OMF format if you wanted to statically link. If you had a DLL you could create an import library from the DLL and still link that just fine. Walter has a tool on Digital Mars to do it. Now you should be able to directly link to COFF libraries.
Aug 20 2014