Interrogate is a program to parse a body of C++ code and build up a table
of classes, methods, functions, and symbols found, for the purposes of
calling into the codebase via a non-C++ scripting language like Python (Scheme and Smalltalk where also tried at some point) The design of interrogate is such that it should be able to produce wrappers for any other language without too much trouble. You'll have to be responsible for writing and maintaining the interface layer to produce the wrappers, though.
In addition to identifying all the classes and their relationships,
interrogate will generate a wrapper function for each callable function.
The wrapper functions will be callable directly from the scripting language,
with no understanding of C++ necessary; these wrapper functions will in turn
call the actual C++ functions or methods.
Most exportable features of C++ are supported, including templates, default
parameters, and function overloading.
Steps for Interrogate:
Create a header file, source file and Inline functions file. (e.g. module.h, module.cxx, module.I). Put in there the source you like.
Run Interrogate on your .h file which will generates module_igate.cxx with the interrogate_module in he module_module.cxx file.
Nextly, you compile all your .cxx files, including the two you got from interrogate.
Link your cxx files together to form a library.
Finally, put your .so or .dll file on your python path for python to load.
There is a sample cxx extension in the skel/ directory in the Panda3D source to use as reference and sand box.
Here's an example of Interrogate usage: (the module name is myModule)
interrogate -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__i386__ -D__const=const
-S/usr/include/panda3d/parser-inc -S/usr/include/ -I/usr/include/panda3d/
-oc myModule_igate.cxx -od myModule.in -fnames
-string -refcount -assert -python-native -module libMyModule -library libMyModule myModule.h
interrogate_module -oc myModule_module.cxx -module libMyModule
-library libMyModule -python-native myModule.in
|