From: Karol L. <kar...@gm...> - 2014-05-25 09:41:56
|
Hello, Is there a way to inject additional code to a specific SWIG(v2.0.11) generated methods in C# (filtered by method name and class)? I'm currently in battle with the C# Garbage collector and done as described at http://www.swig.org/Doc2.0/CSharp.html#CSharp_memory_management_objects (with success). Now I'm trying to create a more generic solution by injecting additional code to the troublesome functions. For example I have a bunch of register and unregister methods (class UserModel): public virtual bool RegisterAffectionModel(AffectionModel affectionModel) { [SWIG generated Code] } Now what I'm trying to achieve is: public virtual bool RegisterAffectionModel(AffectionModel affectionModel) { [SWIG generated Code] registerElementReference(affectionModel); } public virtual bool UnregisterAffectionModel(AffectionModel affectionModel) { [SWIG generated Code] unregisterElementReference(affectionModel); } I've achieved a partial success by using typemap csin and the "pre" attribute. But by using this approach I cannot filter the injection to a specific methods. I understand that there is a workaround for as similar problem as described at http://swig.10945.n7.nabble.com/Apply-typemap -to-single-method-td11684.html. But maybe a more cleaner solution was created since then? Thanks Karol |