C++ wrapper for newlisp ?

Q&A's, tips, howto's
Locked
nigelbrown
Posts: 429
Joined: Tue Nov 11, 2003 2:11 am
Location: Brisbane, Australia

C++ wrapper for newlisp ?

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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]

nigelbrown
Posts: 429
Joined: Tue Nov 11, 2003 2:11 am
Location: Brisbane, Australia

Post 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

Locked