Tag: gnu prolog

使用指针作为C调用Prolog进程的参数的奇怪情况

所以基本上我的测试是在32位x86 Linux上,我使用GNU Prolog 1.4.4 在这种情况下,我有函数ptr.c + pro.pl + interface.c 在ptr.c ,我使用包装器调用pro.pl的Prolog函数,然后在pro.pl ,我使用prolog c接口在interface.c中调用C函数,参数是C指针 。 我在这里为每个文件添加了一些代码: ptr.c : int C_wrapper_foo(int * e) { int return_value; int func; PlTerm arg[2]; // function variable + return value insert PlBool res; func = Pl_Find_Atom(“foo”); // function name insert Pl_Query_Begin(PL_FALSE); printf(“%p\n”, e); arg[0] = Pl_Mk_Integer((unsigned int)e); // See, here I […]