On 03.01.2016 22:37, TheDGuy wrote:
If i rename "test.o" to "test.obj" i get:

'Error: Module or Dictionary corrupt'

My guess is, that means that dmd can't handle the object file format that gcc produces.

Disclaimer: I don't know much about object formats, gcc, and Windows. I may be mistaken in what I write here.

I think there are three object file formats that are relevant for us:

* OMF: the format dmd uses by default on 32 bit Windows,
* COFF: the format dmd uses on 64 bit Windows and in 32 bit mode with the -m32mscoff switch, * ELF: the format gcc uses by default (on Linux at least, maybe on Windows too).

You should probably try to find out what gcc produces (by reading gcc documentation, I supppose).

Then you need to get your D compiler and your C compiler to produce the same format.

As mentioned, dmd has some switches that affect the used/expected object format: -m32 (OMF) -m64 (COFF) -m32mscoff (COFF).

You can also try to get gcc to produce another format. I don't know how to do that.

Or you can use another C compiler that produces a different format than gcc.

I'd expect Digital Mars's (i.e. Walter's) dmc to be compatible with dmd and produce OMF files. Looks like there's a free download:
http://www.digitalmars.com/download/freecompiler.html

dmd's COFF mode is supposed to be compatible with Microsoft's Visual Studio. So that would be another option.

Reply via email to