Calling D from C

evilrat evilrat666 at gmail.com
Sat Nov 23 23:05:28 PST 2013


On Sunday, 24 November 2013 at 06:48:50 UTC, Jesse Phillips wrote:
> On Sunday, 24 November 2013 at 05:54:44 UTC, evilrat wrote:
>> On Sunday, 24 November 2013 at 05:25:36 UTC, CJS wrote:
>>>
>>> bash calls:
>>> dmd -c foo.d
>>> gcc bar.c foo.o
>>>
>>
>> this is wrong. there should flag for building static lib which 
>> should produce foo.a which then you link with C build.
>
> There isn't anything special about .a files, they just contain 
> multiple .o "collections"
>
> He looks to be missing an initialization of the runtime, but 
> then again thought I read something about a trick making that 
> not needed (at least for dynamic loading)... Someone else will 
> have to pitch in what the correct solution is.

this is not about runtime, ld(linker) reports missing symbols, so 
it is either x86/x64 versions mismatch, or maybe with dmd 2.064 
it is necessary to mark exported symbols with "export" keyword


More information about the Digitalmars-d-learn mailing list