Typedef duplicates across modules?
Marc Dannemann <[email protected]> Fri, 16 Jun 2023 10:24:22 +0200
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
I have two modules which share a common class definition and therefore a
required function pointer typedef:
%module Module1
typedef void(*MyClassCallback)(MyClass&);
class MyClass
{
public:
MyClass(MyClassCallback initializer);
};
%module Module2
%import "Module1.i"
%callback("%s_cb");
void DoSomething(MyClass&);
%nocallback;
When I generate C# wrappers for both modules, each module contains the
exact same wrapper class for the function pointer typedef:
public class SWIGTYPE_p_f_r_MyClass__void {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_f_r_MyClass__void(global::System.IntPtr cPtr,
bool futureUse) {
swigCPtr = new
global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_r_MyClass__void() {
swigCPtr = new
global::System.Runtime.InteropServices.HandleRef(null,
global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef
getCPtr(SWIGTYPE_p_f_r_MyClass__void obj) {
return (obj == null) ? new
global::System.Runtime.InteropServices.HandleRef(null,
global::System.IntPtr.Zero) : obj.swigCPtr;
}
internal static global::System.Runtime.InteropServices.HandleRef
swigRelease(SWIGTYPE_p_f_r_MyClass__void obj) {
return (obj == null) ? new
global::System.Runtime.InteropServices.HandleRef(null,
global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
Is this intended behaviour and, if yes, how can I produce valid code
with no conflicting class definitions like this?
Thanks in advance!
Marc
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user