I’m trying to call prolog from C. Consider this simple program:
#include <stdio.h>
#include <SWI-Prolog.h>
int main() {
static predicate_t pred;
term_t result = PL_new_term_ref();
printf("test\n");
}
and compiled with
gcc -I /usr/local/lib/swipl/include/ -L /usr/local/lib/swipl/bin/x86_64-linux/swipl main.c -shared -fPIC
The compilation succeed however, when i run the program, i get a segmentation fault. I’ve just updated SWI by pulling from the main repository on GitHub. What i’m i doing wrong?
Thanks