call C++ function from newlisp code
-
- Posts: 107
- Joined: Tue Jan 15, 2013 11:54 am
- Location: China, Beijing
- Contact:
call C++ function from newlisp code
Is it possible to call a c++ function, I want to build a C++ so file which has some functions for accessing database, then write a newlisp app to use it. I am working on Ubuntu.
Re: call C++ function from newlisp code
In your C++ programs you have to declare functions as extern "C". Then they can be imported into newLISP using either the simple or extended import interface.
Windows DLL:
or on other OS:
Windows DLL:
Code: Select all
extern "C" __declspec( dllexport ) int MyFunc(int a, int b);
Code: Select all
extern "C" int MyFunc(int a, int b);
-
- Posts: 107
- Joined: Tue Jan 15, 2013 11:54 am
- Location: China, Beijing
- Contact:
Re: call C++ function from newlisp code
I made an example, see my blog
http://csfreebird.blogspot.com/2013/12/ ... namic.html
Thank you, Lutz.
http://csfreebird.blogspot.com/2013/12/ ... namic.html
Thank you, Lutz.