Q: how to get C code to work in D?

BCS ao at pathlink.com
Tue Jun 12 16:10:04 PDT 2007


Reply to Hoenir,

> Hoenir schrieb:
> 
>> I got a C file (it's a library, so in C you would create a static
>> library and link it to another program) I want to use in D.
>> I already created the necessary d file as described here:
>> http://www.digitalmars.com/d/interfaceToC.html
>> But how do I link the C code? dmd isn't able to compile C files.
>> 
>> I know how to get a dll working (creating C dll, corresponding lib
>> with
>> implib and then adding that lib to the command line of dmd) but I
>> want
>> it to be statically linked like in C.
>> Any hints?
> It works now if I use the obj file. But what if I want to import
> several files, which switch do I need to create a lib?
> 

I think their is a lib.exe next to dmc

http://www.digitalmars.com/ctg/lib.html




More information about the Digitalmars-d-learn mailing list