Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Created February 23, 2012 23:39
Show Gist options
  • Save SiegeLord/1895766 to your computer and use it in GitHub Desktop.
Save SiegeLord/1895766 to your computer and use it in GitHub Desktop.
D shared libs from C
void test_func();
int main()
{
test_func();
return 0;
}
import std.stdio;
void main()
{
}
extern(C) void test_func()
{
writeln("Hello from D");
}
@SiegeLord
Copy link
Author

ldc2 -relocation-model=pic -shared test.d -soname test.so
gcc test.c -L. -ltest -otest
LD_LIBRARY_PATH=`pwd` ./test
Segmentation fault

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment