[capi-sig] Creating type object dynamically in run-time

Stefan Behnel python_capi at behnel.de
Thu May 10 19:58:51 CEST 2012


Mateusz Loskot, 10.05.2012 18:58:
> Long story short, I have a software system implemented in C/C++ which
> provides public API. The API is not fixed, may change, so scripting
> engines use provided means of reflection to inspect this API and
> generate bindings on-fly.
> I embedded Python in this system and now I'm using the mentioned
> reflection mechanisms to discover API and generate Python extension
> modules and types dynamically during run-time.
> 
> I simply use the reflection mechanisms provided to iterate over
> definitions (structures, functions, constants, etc.) of the public API
> and I compose Python extension types grouping methods, etc.

Interesting. So you're reflecting on a C/C++ API to dynamically export it
to Python space? Then I guess that your internal binding code is also
rather generic, right? It won't be able to call the application code
directly, for example, if it doesn't know the API at compile time.


> I can not use Cython, nor I can use tools like SWIG, Boost.Python.
> The (C)Python is the only tool I can use.

Also interesting. I wonder who would notice with which tool you have
written your source code once it's compiled...

Stefan


More information about the capi-sig mailing list