digitalmars.D - using .a c libraries compiled on linux
Is it possible to call functions defined in a .a library created using object files compiled with GCC in DMD? If so, how do you call these functions from a D application?
Sep 13 2007
Reply to llee,Is it possible to call functions defined in a .a library created using object files compiled with GCC in DMD? If so, how do you call these functions from a D application?to call the C function: int Foo(int bar, char* baz) add the line : extern(C) int Foo(int bar, char* baz); to your d code, call the function as you would any other d function and then link with the .o or .a file with the function in it. I think you can link in files just by adding them to the dmd command line, or you can copy the gcc command line that dmd outputs and add the needed files (the -c flag will stop dmd from tying to link) Somewhere in the docs is a page about how to convert other types and things.
Sep 13 2007