How To Call D Code from Objective C?

Mike McKee via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 11 01:18:00 PST 2015


Well, part of it was that I needed to do -shared on Linux instead 
of -dynamiclib. On OSX, I have to use -dynamiclib.

It compiles now on the C code, but when I created a cmain.c to 
test the library, it gave me a segmentation fault when trying to 
run this compiled program, even though I copied gfunc.o and 
cfunc.o to /usr/lib on Linux.

// cmain.c
#include <stdio.h>
extern char * c_dfunc(char *s);

void main() {
         printf("%s\n",c_dfunc("request"));
}




More information about the Digitalmars-d mailing list