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

From: Kish Shen <kisshen_at_...5...>
Date: Tue, 18 Sep 2007 15:09:58 +0100
Carlos Gonzalez-Cadenas wrote:
> 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?
>
>
>
>     > :- module(calendric_unit).
>     >
>     > :- lib(ic).
>     > :- lib(calendar).
>     >
>     > :- export
>     >     interval/3,        % interval(julian_time, interval_type, result)
>
>                     ^^^
>             syntax error
>
The comma (,) should be a fullstop (.), unless you are exporting other 
predicates you have not shown here.

With interactive ECLiPSe, did you try exactly the same ECLiPSe code in a 
different module where you had to import the module calendric_unit as well?

>
>     >
>     > 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.
>     >
>
>     >
>
A more general point about using the C/C++ API - you posted a message 
asking about usage of the C API, and I suggested that you should do as 
much as possible on the ECLiPSe side.  While you can call simple goals 
like interval/3 here from the C API, I think this is generally not a 
very good idea, as you need to write quite complex C/C++ code to compose 
the goal, and to decompose it to get the result. It would be better if 
you can call interval/3 from your ECLiPSe code, and do as much of your 
coding in ECLiPSe, and only call ECLiPSe, passing in the minimal of data 
you need to.

Cheers,

Kish

>
>     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@...2... <mailto:ECLiPSe-Users@...2...>
>     http://www.crosscoreop.com/mailman/options/eclipse-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users@...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>   
Received on Tue Sep 18 2007 - 15:11:55 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST