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

From: Carlos Gonzalez-Cadenas <carlos_at_...80...>
Date: Tue, 18 Sep 2007 20:08:22 +0200
Hi Kish,

Thank you very much for your help.

I've replaced the "," by a "." and now ECLIPSE doesn't complain "method not
found", but I still get a core dump. Any hints about that? (I suppose that
the offender is the EC_ref, because if I call a method like writeln with no
refs, it works correctly).

My goal is not to perform much work in the C++ part, but also to call
"end-user" functions (the functions I need from the client point of view). I
want to  have as much code as possible in the ECLIPSE. But I need at a
minimum to be able to call functions and pass parameters back and forth,
right?

Best regards,

Carlos

On 9/18/07, Kish Shen <kisshen_at_...5...> wrote:
>
> 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_at_...2... <mailto:ECLiPSe-Users_at_...2...>
> >     http://www.crosscoreop.com/mailman/options/eclipse-users
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ECLiPSe-Users mailing list
> > ECLiPSe-Users_at_...2...
> > http://www.crosscoreop.com/mailman/options/eclipse-users
> >
>
Received on Tue Sep 18 2007 - 19:08:38 CEST

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