www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - linking library files under linux

reply llee <llee goucher.edu> writes:
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. 
Aug 18 2007
parent Frank Benoit <keinfarbton googlemail.com> writes:
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 );
Aug 18 2007