Sorry, SWIG does not allow you to put more than one custom code block in a proxy class :(

 

The only way I know of to put any amount of code in the proxy class is to use

 

%typemap(csclassmodifiers) SWIGTYPE "public partial class"

 

and then make your own *.cs file that contains a partial class to manually add the stuff you want in the class.

 

From: Eric Cabot [mailto:Eric.Cabot@autodesk.com]
Sent: Thursday, September 20, 2012 2:02 PM
To: swig-user@lists.sourceforge.net
Subject: [Swig-user] How can I cumulate %typemap(cscode) !

 

I have two places in my .i files where I use %typemap(cscode) on the same class.

 

e.g.:

%typemap(cscode) MyClass %{

                // part #1...

%}

...

%typemap(cscode) MyClass %{

                // part #2...

%}

 

The problem is that they dont cumulate.  The last one wins !

 

I know the best would be to merge the two typemaps together but it’s impossible in my context.

(i.e.: the %typemap(cscode) is part of a macro that I call more than once on the same class !)

 

I tried to do this before the second one:

$typemap(cscode,MyClass) ;

%typemap(cscode) MyClass %{

                // part #2...

%}

 

But not luck....

 

Is there a way to do it ?

 

Any help would be appreciated...

 

Thanks