Problem with C++ code interface into LispWorks
Hello everybody,
I am using SWIG to generate CFFI code to be used into LispWorks 6. So, the interface is between C++ and Common Lisp. Then, I try to call that function from LispWorks :
std::string test() {
freopen ("/tmp/mystdout.txt","w",stdout);
freopen ("/tmp/mystderr.txt","w",stderr);
std::cout << "Redirected stdout." << std::endl;
std::cerr << "Redirected stderr." << std::endl;
GRelation testgr(3);
std::cout << "test ! " << std::endl;
std::cerr << "test cerr! " << std::endl;
std::cout << testgr.arity() << std::endl;
std::cerr << testgr.arity() << std::endl;
std::cout << "test after! " << std::endl;
std::cerr << "test cerr after! " << std::endl;
std::stringstream os;
os << testgr << std::endl ;
return os.str();
}
As you can see, I just create one object and print lots of stuff, including an object attribute. Everything I print before trying to print the attribute prints ok in the redirected outputs. The attribute is not printed and nothing else afterwards. I also get the following error when I add testgr to the stringstream os :
lispworks-personal-6-0-1-macos-universal(52881,0xb0314000) malloc: *** error for object 0x17be20f8: pointer being freed was not allocated
This is what happen in LispWorks. If I compile directly in C++, no problem. If I use SBCL (other Common Lisp implementation) instead of LispWorks, everything work correctly. But I have to use LispWorks so here are my two questions :
1/Is it possible to disable totally the garbage collector of LispWorks 6 ? Apparently, gc-off doesn't exist anymore. I don't know much about garbage collection but I thought that maybe the problem comes from there.
2/Does anybody has had a similar problem ? I guess I am not the only one who tried to call some C++ from LispWorks.
I thank you in advance for your help, I am really stuck here.
Regards,
Sascha