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

Nikolaus Rath Nikolaus at rath.org
Sun Dec 27 23:46:28 CET 2009


Roman Yakovenko <roman.yakovenko at gmail.com> writes:
> 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.

Don't worry, I don't care what the default is as long as I can change it
:-).

>> 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.

Works like a charm, thanks a lot!

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



More information about the Cplusplus-sig mailing list