Re: [eclipse-users] invoking module function from C API

From: Carlos Gonzalez-Cadenas <carlos.gonzalez_at_...81...>
Date: Sun, 16 Sep 2007 19:31:24 +0200
Joachim,

I've tested it with interactive eclipse, and it works.

Could you please give me more info about the syntax error you point in the
export?

Thanks a lot,

Carlos

On 9/16/07, Joachim Schimpf (Independent Contractor) <jschimpf_at_...5...>
wrote:
>
> Carlos Gonzalez-Cadenas wrote:
> > Hi,
> >
> > I have the following module installed in the lib directory of Eclipse:
> >
> > :- module(calendric_unit).
> >
> > :- lib(ic).
> > :- lib(calendar).
> >
> > :- export
> >     interval/3,        % interval(julian_time, interval_type, result)
>
>                 ^^^
>         syntax error
>
>
> >
> > interval(X,month,Interval) :- mjd_to_date(X, D/M/Y),
> > date_to_mjd(1/M/Y,Ini), Tmp is M+1,date_to_mjd(1/Tmp/Y,End), Interval
> > $>= Ini, Interval $<End.
> >
> > I'm invoking "interval" from the C API. I want to execute the goal and
> > to obtain the value in Interval.
> >
> > My code (in C++) is like this:
> >
> > #include "eclipseclass.h"
> > #include <stdio.h>
> >
> > int main(int argc, char** argv)
> >     {
> >         ec_init();
> >
> >     EC_ref result;
> >
> >     post_goal(term(EC_functor("import",1), EC_atom("calendric_unit")));
> >     post_goal(term(EC_functor("interval",3), EC_word(54000),
> > EC_atom("month"), result));
> >
> >         if (EC_succeed == EC_resume()){
> >         printf("\nok");
> >     }else{
> >         printf("\nfail");
> >     }
> >         ec_cleanup();
> >     }
> >
> > I can compile the program sucessfully, but when I execute it I get the
> > following error:
> >
> > calling an undefined procedure interval(54000, month, _1075) in module
> > eclipse
> >
>
> This should work.  Have you checked whether your library
> compiles correctly?  Test it with an interactive eclipse
> before you use it through the C interface.
>
>
> -- Joachim
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>
Received on Sun Sep 16 2007 - 18:31:33 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:19 CEST