Can't get D calling C to build.

Bob Cowdery bob at bobcowdery.plus.com
Fri Aug 20 01:17:22 PDT 2010


 Thanks for the replies. I've bounced off D a few times because it
didn't seem ready to risk a whole development. I should have mentioned
I'm trying this on Windows 7. I did suspect object formats were
incompatible but as you say would have expected a decent error message.
I also tried from the command line with the same problem, it just
generates an empty map file and nothing else. I also tried using gdc,
now surely the output of gcc and gdc must be compatible. However, it
didn't work and it doesn't look like gdc is being actively developed.

I'm still concerned it's a bit too soon as a lot of things seem to be
either Windows or Linux (cmake says its only tested for *nix) but not
both and there is very little guidance on building. I really want to get
this working on Windows first. As D makes so much of its binary
compatibility with C I find it odd that there is no information on how
to build mixed systems just on how to code the calls.

dmc gives me this error:
OPTLINK : Error 118: Filename Expected
LIB="C:\D2.0\dm\bin\..\lib";"C:\D2.0\dm\bin\..\mfc\lib";C:\Program
Files\Gtk+\lib

The paths are correct as far as I can tell.

Sorry, didn't mean that to sound like a rant, just not sure where to go
from here. Anybody got a definitive answer as to what works on Windows.

bob


>Jonathan M Davis said

>My first question would be whether you used the same linker for both D and C. On 
>Linux, they should both be using gcc. On Windows, they should both be using dmc. 
>Still, I would have expected a linking error to be a bit more explosive than 
>nothing.

>steve said

>My experience has been the opposite - dmd is needed to link programs
>that mix C and D.  While you may not want to jump into CMake for
>builds, the regression tests for cmaked include building and link D+C
>objects and D + C libraries.
>http://code.google.com/p/cmaked2/wiki/GettingStarted
>FYI, cmaked is still work in progress, so you might run into bumps.
>-steve

>Kagamin said

>On windows dmd uses ancient OMF object format, but gcc compiles to COFF.





More information about the Digitalmars-d-learn mailing list