problem interfacing prolog and C

Erick Alphonse <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hello,

I would like to call prolog from C, but I can't even get it working on 
this very simple example:

% test.pl
:- initialization(top).

:- foreign(write_c(+term),[return(none)]).

top :-
         write_c(a).

% test_c.c
#include "gprolog.h"

void write_c(PlTerm In) {
   Create_Atom("writeq");
}

I compile with (under 1.2.18 or 1.2.16) : gplc test_c.c test.pl -o test
and I get a Fatal Error: Segmentation Violation.

Could someone explain to me what is wrong please?

Thanks a lot in advance for helping me out,
Regards,
Erick.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.