Calling D function from C

Jonathan Crapuchettes jcrapuchettes at gmail.com
Wed Apr 23 09:17:40 PDT 2008


I tried both gdc and dmd for the D code and both had gcc create the same linker 
errors.
Thanks
JC

Bruce Adams wrote:
> On Wed, 23 Apr 2008 07:36:26 +0100, Johan Granberg 
> <lijat.meREM at OVEgmail.com> wrote:
> 
>> Jonathan Crapuchettes wrote:
> 
>>> ------------ Compiled As ---------------
>>> /opt/dmd/bin/dmd test.d -c
>>> gcc main.c test.o -m32 -o tester -lphobos -lpthread -lm
>>> Linker Error...
>>
>> The code looks ok to me, wath if you compile the c code first and then 
>> use
>> dmd to link it (dmd probably uses some linker flags you did not think of)
> 
> Although in theory both compilers are generating compatible ELF objects 
> I would be wary of mixing
> compilers this way and much more comfortable using either dmc & dmc or 
> gdc & gcc together.


More information about the Digitalmars-d-learn mailing list