I'm having troubles properly overriding the return value on some functions I'm trying to map. I have multiple <map function= mappings, the first of which applies to all functions that I import, and the second of which specifically takes one single function of which I need to override the return value:
<mapping>
<!-- Default config for all elements -->
<map element=".*" visibility="internal" />
<!-- Default mappings of exported symbols -->
<map struct=".*" group="MyGroup.Types" />
<map function="(.*)" group="MyGroup.Functions" name="$1" dll=""somelibrary"" />
<!-- Overrides for specific function parameters and return types -->
<map function="a_specific_function" type="SomeType" />
</mapping>
The first 3 mappings are all definitely applied, however the type attribute on the final mapping does not work. I actually suffered through setting up a locally packaged version of SharpGenTools to debug the SDK while my project is building, and I can see the rule being applied on the a_specific_function "Callable", but it looks like Rule.MappingType is simply not used for functions. I found where it is applied for in lines 125-130 of MethodTransform.cs but for some reason it isn't sticking, or is getting reset somewhere. I set a breakpoint on line 142 of InteropSignatureTransform.cs and the value of callable.ReturnValue that gets passed to GetInteropTypeForReturnValue is the default return type, not the one specified in the rule I have (I can see in the debugger that the value of callable.CppElement.Rule.MappingType is exactly what I'm trying to set it to, it's just not being obeyed).
When a_specific_function is generated, it uses the default return value type no matter what I do.
Something else I noticed is that, because IsFinalMappingName defaults to false and not null, it causes the name="$1" attribute on the first function mapping to have no effect on a_specific_function due to line 122 in CppElement.Extensions.cs, and the default naming rules are applied instead.
I'm having troubles properly overriding the return value on some functions I'm trying to map. I have multiple
<map function=mappings, the first of which applies to all functions that I import, and the second of which specifically takes one single function of which I need to override the return value:The first 3 mappings are all definitely applied, however the
typeattribute on the final mapping does not work. I actually suffered through setting up a locally packaged version of SharpGenTools to debug the SDK while my project is building, and I can see the rule being applied on thea_specific_function"Callable", but it looks likeRule.MappingTypeis simply not used for functions. I found where it is applied for in lines 125-130 ofMethodTransform.csbut for some reason it isn't sticking, or is getting reset somewhere. I set a breakpoint on line 142 ofInteropSignatureTransform.csand the value ofcallable.ReturnValuethat gets passed toGetInteropTypeForReturnValueis the default return type, not the one specified in the rule I have (I can see in the debugger that the value ofcallable.CppElement.Rule.MappingTypeis exactly what I'm trying to set it to, it's just not being obeyed).When
a_specific_functionis generated, it uses the default return value type no matter what I do.Something else I noticed is that, because
IsFinalMappingNamedefaults tofalseand notnull, it causes thename="$1"attribute on the firstfunctionmapping to have no effect ona_specific_functiondue to line 122 inCppElement.Extensions.cs, and the default naming rules are applied instead.