August 18, 2007 linking library files under linux | ||||
---|---|---|---|---|
| ||||
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. |
August 18, 2007 Re: linking library files under linux | ||||
---|---|---|---|---|
| ||||
Posted in reply to llee | 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 );
|
Copyright © 1999-2021 by the D Language Foundation