Skip to content

Commit 0d3801d

Browse files
committed
Fix typemap for 'out' variables of type void*
1 parent aa07acd commit 0d3801d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

etgtools/cffi/basictype.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,23 @@ def build_typeinfo(self, typeinfo):
329329
typeinfo.wrapper_type = const + 'void*'
330330

331331
def call_cdef_param_setup(self, typeinfo, name):
332+
if typeinfo.flags.out:
333+
return ("{0}{1.CFFI_PARAM_SUFFIX} = ffi.new('void**')"
334+
.format(name, typeinfo))
335+
336+
if typeinfo.flags.inout:
337+
return """\
338+
{0}{1.CFFI_PARAM_SUFFIX} = ffi.new('void**', {0})
339+
""".format(name, typeinfo)
340+
332341
return name + typeinfo.CFFI_PARAM_SUFFIX + ' = ' + name
333342

334343
def convert_variable_cpp_to_c(self, typeinfo, name):
335344
return name
336345

337346
def convert_variable_c_to_py(self, typeinfo, name):
347+
if typeinfo.flags.out or typeinfo.flags.inout:
348+
return '%s%s[0]' % (name, typeinfo.CFFI_PARAM_SUFFIX)
338349
return name
339350

340351
def user_cpp_param_inline(self, typeinfo, name):

0 commit comments

Comments
 (0)