Georg Fette wrote: > > Hiho, > I have now managed to link my external C++-function to a eclipse-function, > but when I call it in eclipse it simply crashes with a windows-"bad memory > reference error" and my eclipse-ide is closed. When I made some tests with > my C++-function I found out, that the crash happens, when the > input-parameter is unified. This is my code: > > #include <eclipseclass.h> > > extern "C" __declspec(dllexport) int p_test() { > char *myString; > > ec_get_string(ec_arg(1), &myString); > return EC_succeed; > } > > Do I use the ec_get_string-function in a wrong way ? > Thx for answers. > > Georg You need to use the C++ interface functions/methods. See "Embedding and Interfacing Manual" Appendix "Summary of C++ Interface Functions" "Decomposing ECLiPSe terms in C++" EC_word EC_arg(int i) returns the i'th argument of the predicate call. int EC_word::is_string(char **) checks whether the EC_word is a string (or atom) and converts it to a C++ string. This string is volatile, ie. it should be copied when it is required to survive resuming of ECLiPSe. int EC_word::is_string(char **, long *) checks whether the EC_word is a string (or atom) and converts it to a C++ string. This string is volatile, ie. it should be copied when it is required to survive resuming of ECLiPSe. The string's length is returned in the second argument. -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc, Imperial College / mailto:J.Schimpf@ic.ac.uk London SW7 2AZ, UK / http://www.icparc.ic.ac.uk/eclipseReceived on Wed Dec 04 10:59:02 2002
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:19 PM GMT GMT