替代SICStus Prolog FFI SP_define_c_predicate()

时间:2016-07-13 02:30:33

标签: prolog ffi sicstus-prolog

我粘贴了SICStus Prolog 4.3.3 SP_define_c_predicate()样本按原样并且<失败

$ /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

到目前为止,我为SP_WORD抓取了SICStus C包含文件 - 无济于事。

您是否有一些提示我如何才能使其发挥作用?提前谢谢!

(仅供参考:我使用x86-64 Linux Mint 17和gcc版本4.8.4。)

1 个答案:

答案 0 :(得分:3)

示例应该使用SP_integer而不是内部类型SP_WORD