[C++-sig] [Py++] Don't transform char* to c_char_p

Roman Yakovenko roman.yakovenko at gmail.com
Sun Dec 27 22:18:44 CET 2009

On Thu, Dec 24, 2009 at 1:55 AM, Nikolaus Rath <Nikolaus at rath.org> wrote:
> I think POINTER(c_char) should indeed be the default because it is the
> safer choice.

Unfortunately, I don't agree with you. It is a safer choice - right,
but it should not be the default.

> Maybe a parameter a new keyword parameter in the ctypes_module_builder_t
> constructor would be a good way to customize this.
> On the other hand, the only situation were the user can actually notice
> this change would be in a Python callback function that's called from C,
> because it will receive a ctypes object rather than a Python string. But
> a string can still easily be obtained with string_at (while the reverse
> is not possible). So maybe it is also possible to always generate
> POINTER(c_char) without the option to change this to c_char_p.

I added new functionality, which allows to generate POINTER( c_char )
instead of c_char_p.

The relevant commit are:
* http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1786&view=rev
* http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1790&view=rev

The functionality should be used like:

mb = ctypes_module_builder_t( ... )
mb.treat_char_ptr_as_binary_data = True


Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list