[C++-sig] [Py++] Generate Python code for ctypes?

Roman Yakovenko roman.yakovenko at gmail.com
Mon Dec 14 20:44:52 CET 2009


On Mon, Dec 14, 2009 at 1:55 AM, Nikolaus Rath <Nikolaus at rath.org> wrote:
> I tried to create a patch, but when I tried to find out where the
> 'CDLL(...)' code is actually written, I got completely lost in the
> source...

I suggest you to read the following document:
http://language-binding.net/pyplusplus/documentation/architecture.html#code-generation-engine
I hope it will clarify few things.

>
> What I don't quite understand is what the symbols file is actually used
> for. The code seems to determine the symbols available in the shared
> library, but what is it doing with that information?

Py++ uses information extracted from shared library
* to define the exact set of declarations which needs to be exported
* to extract the function calling convention
* to extract "mangled" function and/or variable name - later it will
be used to provide access to that symbol.

For example, you can use C++ compiler to compile "C" code and still
get access to the functionality.

> Certainly all the
> exported symbols should already be available from parsing the header
> file... Is it possible to omit the symbols file and generate code based
> only on the headers?

I don't think so( it didn't worked in my use case ) but you can try.
Start to comment out code in ctypes_builder.py and post the result :-)

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list