C++ wrapper for newlisp ?

Started by nigelbrown, March 29, 2005, 06:33:37 PM

Previous topic - Next topic

nigelbrown

I have to delve into the world of C++ and wondered if anyone has a wrapper class already done for newlisp? I realise I can do C calls within C++ but was wondering about a more 'native' solution.



Nigel

Lutz

#1
I assume you want to import newlisp.so or newlisp.dll from a C++ application? When using C++ I guess you would have to declare all imported functions as:



extern "C" { int myImportFunc(); }



You then can call myImportFunc(); from inside a C++ Class function. I don't think that there is any other possibility, because all C++ function and class names are 'mangeled' to different names by the C++ preprocessor before compiling and linking, the 'extern' declaration protects from that. My C++ knowledge is a bit rusty though.



May be there are special import facilities in the C++ Class library you are using, which take care of everything?



Lutz[/code]

nigelbrown

#2
Thanks for the pointer Lutz.

I was actually wondering if someone had already done a full class

eg maybe a class that acts like a iostream sink/source treating newlisp

like an interaction with a user viz

newlispout << "(+ 2 3 4)"

newlispin >> strResult



 - if not I'll post anything worthwhile I code.



Regards

Nigel