Is there any tool that can automatically generate Prolog callable interface from C functions?

Shuai Wang <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <CAEQMQo=VgpMoccso6t0FYrKFGekyTQhA_iJVEATwr2CD+ya=cA@mail.gmail.com>
So basically I am using Prolog to call a large number of C functions using
GNU-Prolog.

Here is an example:

int add(int a, int b)
{
int res = a + b;

return res;
}

If I want to call this function from Prolog code, I need to create this
interface:

#include <gprolog.h>

 PlBool add_interface(int a, int b, int* r)
{
  *r = add(a, b);
}

And In the Prolog code, I need add this :

 :- foreign(add(+integer, +integer, -integer)).

So I am dealing with a large number of C functions, and manually create
these interface one by one would be quite time consuming...

Of course I can write an ad-hoc tool to do this creation(Using CIL
probably..), but I just don't want to reinvent the wheel.

So my question is :

Is there any tool that can automatically generate Prolog callable interface
from C functions?

_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
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.