Page 1 of 1

C++ wrapper for newlisp ?

Posted: Wed Mar 30, 2005 2:33 am
by 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

Posted: Wed Mar 30, 2005 2:24 pm
by Lutz
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]

Posted: Wed Mar 30, 2005 8:54 pm
by nigelbrown
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