Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative SICStus Prolog FFI SP_define_c_predicate()

I pasted the SICStus Prolog 4.3.3 SP_define_c_predicate() sample as-is—and... failed:

$ /usr/local/sicstus4.3.3/bin/splfr square.pl square.c
square.c: In function ‘square_it’:
square.c:7:3: error: unknown type name ‘SP_WORD’
   SP_WORD arg1;
   ^
square.c:13:3: warning: passing argument 2 of ‘sp_GlobalSICStus_square->dispatch_API_SICSTUS_H->pSP_get_integer’ from incompatible pointer type [enabled by default]
   if (!SP_get_integer(tmp,&arg1))
   ^
square.c:13:3: note: expected ‘SP_integer *’ but argument is of type ‘int *’
Uncaught exception from user code:
    ! Could not compile square.c

So far, I grepped the SICStus C include files for SP_WORD—to no avail.

Do you have some hints how I can make it work? Thank you in advance!

(FYI: I'm using x86-64 Linux Mint 17 with gcc version 4.8.4.)

like image 540
repeat Avatar asked Dec 11 '25 23:12

repeat


1 Answers

The examples should have used SP_integer instead of the internal type SP_WORD.

like image 81
Per Mildner Avatar answered Dec 13 '25 21:12

Per Mildner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!