How to script a c++ library
We have a c++ library (dll) on the windows platform. It exports some c++ classes . These dlls are not COM dlls, that is the classes/objects are not COM objects, and they don't support IDispatch interface . The library is basically used by C++ applications the usual way , by including headers and linking to the dlls. How can we make the libary scriptable ? Meaning that the objects can be created and their methods should be callable from a script like language . This would enable things to be done in batch processing mode , and test suites to be automated.
Create a hierarchy of COM objects which use the DLL on the backend and expose a COM interface on the other.
>Create a hierarchy of COM objects which use the DLL on >the backend and expose a COM interface on the other.
Have a look at:
Wrapping stuff for PHP is very easy. This is probably why PHP has so many functions :)
You can also check out the Boost.Python library. http://www.boost.org/libs/python/doc/
If you want to put a COM interface on a C++ library, you're going to have to write one. There's really no other way to do it. At least you don't need re-implement the actual logic, so the COM coding is fairly boilerplate.
Fog Creek Home