Re: passing structures from C++ to ECLiPSe

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Wed 17 Aug 2005 10:08:34 AM GMT
Message-ID: <43030CA2.2060201@icparc.ic.ac.uk>
Jan Kelbel wrote:
> Hello,
> I would like to pass some data from C++ to eclipse and back, and
> as a first experiment I created in C++ a list of ECLiPSe
> structures (according to 3.1.5 in Embedding and interfacing manual) and
> passed this list as an argument to an ECLiPSe predicate.
> 
> C++ code:
>     ec_init();
>     //compile ecl file with predicate printlist/1
>     post_goal(term(EC_functor("compile",1),"eclipsecpp.ecl"));
>     EC_resume();
> 
>     //create list
>     EC_functor task("task",2);
>     EC_refs T(3);
>     char* names[3] = {"one","two","three"};
>     int durations[3] = {1,2,3};
> 
>     for (int i=0; i<3; ++i)
>     {
>         T[i] = term(task,names[i],durations[i]);
>     }
>     EC_word tasklist = list(T);

See this section of the Interfacing Manual for how to construct
a list in C++

http://www.icparc.ic.ac.uk/eclipse/doc/embedding/node7.html#SECTION00314000000000000000

-- 
  Joachim Schimpf              /             phone: +44 20 7594 8187
  IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
  Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Wed Aug 17 11:12:08 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:39 PM GMT GMT