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); //call predicate printlist/1 post_goal(term(EC_functor("printlist",1),tasklist)); EC_resume(); eclipsecpp.ecl: printlist([]). printlist([H|T]) :- arg(1,H,N),writeln(N), printlist(T). The execution of cpp program ends with error: instantiation fault in arg(1, _1842, N) But when I create the list in ECLiPSe tasklist([task("one",1),task("two",2),task("three",3)]). and then execute query ?tasklist(T),printlist(T). it works. I don't know whether the structures created in C++ are in ECLiPSe structures with field names or not, and i don't know how to access them properly. Can you tell me, what I'm doing wrong? I use ECLiPSe 5.8/WinXP/VisualC++ .NET2003 Thanks in advance, Jan KelbelReceived on Wed Aug 17 10:13:11 2005
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:39 PM GMT GMT