using pragma to link to gcc-compiled c library
Artur Skawina
art.08.09 at gmail.com
Tue Jun 5 18:15:44 PDT 2012
On 06/06/12 02:33, Felix Klein wrote:
> hi,
>
> i'm having a hard time linking a c function into d. i've looked at many posts about this, but can't seem to get it to work. at the moment i'm trying to use pragma in the d source to help dmd find the function. unfortunately the linker can't find it.
>
> felix at mojo:~/d/misc$ cat ctest.d
> import std.stdio;
> pragma(lib, "/home/felix/d/misc/libcadder.a");
>
> void
> main()
> {
>
> extern (C) int addem (int, int);
Move the proto out of main() into the module scope - as is,
it's treated as a nested function and gets its name mangled.
artur
More information about the Digitalmars-d-learn
mailing list