invalid directive foreign(...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

invalid directive foreign(...

cschick
Hi,

I have a project in which I need to convert a date to a unique number
and vice versa. For simplicity reasons, the unique number is the number
of days since 1.1.1970.

I have found some C code and changed it according to my needs. It was
working nicely when testing it in a C main programme.

However, when I modeled the predicate to be later used in the project on
the example in the manual and compiled it with gplc ("gplc date_unix.pl
date_unix.c"), I got a message "invalid directive
foreign(date_unix(?stamp,?year,?month,?day))."

I cannot find my mistake, is there anything that I did not spot when
writing the predicate? I have attached the sources as a tar file, I hope
this is OK.

Cheers Christoph

_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog

date_unix.tar (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: invalid directive foreign(...

"Micha� Bieli�ski"
Dnia 6 Grudnia 2015, 07:24, N, Christoph Schick napisał:
> Hi,

Hello.

> I got a message "invalid directive
> foreign(date_unix(?stamp,?year,?month,?day))."

In directive foreign you are not supposed to deliver parameter names from
C. Name a type instead:

:- foreign(date_unix(?positive,?positive,?positive,?positive)).

--
Michał


_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog