linking library files under linux

Frank Benoit keinfarbton at googlemail.com
Sat Aug 18 09:51:35 PDT 2007


llee schrieb:
> I'm trying to create a library and link it into my program. I used
> gcc to compile a number of c files into object files, and created a
> .a library file using ar. I then used gcc to create an .so library
> from these object files.  Can someone give me the command line
> arguments needed to link either of these libraries with a d program?
> Can someone tell me what commands are needed to use the definitions
> provided by these libraries in a d program.


Just add the .a to the command line of the gdc/dmd or the linker.

To use the funtions from within D, you need the declaration with extern(C).

int func( char* str );

becomes

extern(C) int func( char* str );



More information about the Digitalmars-d mailing list