Hi.
I'm trying to call c from gprolog and I have some
problems when I use the foreign type "-string" to
obtain the result of the c function.
This the file teste.c:
#include "gprolog.h"
Bool test(char *in, char *out){
//out = (char *) malloc(1024*sizeof(char));
//out = (char *) alloca(1024);
sprintf(out, "teste");
printf("IN:%s\n", in);
return TRUE; /* succeed */
};
And this is the file test.pl
:- foreign(test(+string,-string)).
when I compile both of them with:
gplc test.c test.pl
I get an executable file.
When I run this file and enter "test(xpto, X)."
gprolog
just crahs, with the folowing error:
Fatal Error: Segmentation Violation
Anyone knows how to put this little exmaple working.
Thank's.
Pedro Salgueiro
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
_______________________________________________
Users-prolog mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/users-prolog
--
Ce message a subi une analyse antivirus
par MailScanner ; il est vraisemblablement
sans danger.