Brendan Miller schrieb:
I have a function exposed through ctypes that returns a c_char_p.
Since I need to deallocate that c_char_p, it's inconvenient that
ctypes copies the c_char_p into a string instead of giving me the raw
pointer. I believe this will cause a memory leak, unless ctypes is
On Apr 21, 2010, at 6:29 PM, Brendan Miller wrote:
Here's the method I was using. Note that tmp_char_ptr is of type
c_void_p. This should avoid the memory leak, assuming I am
interpreting the semantics of the cast correctly. Is there a cleaner
way to do this with ctypes?
def
On Apr 22, 2010, at 10:49 AM, Zvezdan Petkovic wrote:
libc.strdup.argtype = [ctypes.c_char_p]
Correcting my typo. This should be in plural:
libc.strdup.argtypes = [ctypes.c_char_p]
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 22, 2010 at 7:49 AM, Zvezdan Petkovic zvez...@zope.com wrote:
On Apr 21, 2010, at 6:29 PM, Brendan Miller wrote:
Here's the method I was using. Note that tmp_char_ptr is of type
c_void_p. This should avoid the memory leak, assuming I am
interpreting the semantics of the cast
I have a function exposed through ctypes that returns a c_char_p.
Since I need to deallocate that c_char_p, it's inconvenient that
ctypes copies the c_char_p into a string instead of giving me the raw
pointer. I believe this will cause a memory leak, unless ctypes is
smart enough to free the
Here's the method I was using. Note that tmp_char_ptr is of type
c_void_p. This should avoid the memory leak, assuming I am
interpreting the semantics of the cast correctly. Is there a cleaner
way to do this with ctypes?
def get_prop_string(self, prop_name):
# Have to work with