From 54af856d0974810f7305faad296e7c2ca732f6ec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Nov 2021 00:50:33 +0100 Subject: [PATCH] Fix typemaps for arrays of objects and object pointers These typemaps never worked, but this went unnoticed until now because the nonsensical "ctype" expansion generated by them still compiled. With types possibly having a namespace prefix, they didn't any longer, so define them correctly for the objects using "$resolved_type" and define the typemap for "void*[]" separately, as "$resolved_type" can't be used for it. --- Lib/c/c.swg | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/c/c.swg b/Lib/c/c.swg index 166bd3aa8..76fe25024 100644 --- a/Lib/c/c.swg +++ b/Lib/c/c.swg @@ -113,12 +113,15 @@ same_action(TM, size_t, ACTION, ACTION_CREF); same_macro_all_primitive_types_but_void(same_type,ctype); same_macro_all_primitive_types_but_void(cref_as_value,ctype); +// trivial typemap for arrays of void pointers to avoid applying the object typemaps to them +%typemap(ctype) void*[ANY] "void **" + // objects %typemap(ctype) SWIGTYPE "$&resolved_type*" %typemap(ctype) SWIGTYPE * "$resolved_type*" %typemap(ctype) SWIGTYPE & "$*resolved_type*" -%typemap(ctype) SWIGTYPE [ANY] "/*SWIGTYPE [ANY]*/ $1_ltype **" -%typemap(ctype) SWIGTYPE * [ANY] "/*SWIGTYPE *[ANY] */ $1_ltype **" +%typemap(ctype) SWIGTYPE [ANY] "$resolved_type*" +%typemap(ctype) SWIGTYPE * [ANY] "$resolved_type**" %typemap(ctype) enum SWIGTYPE "int" %typemap(ctype) enum SWIGTYPE &, enum SWIGTYPE * "int *"