You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 -->
<mapelement=".*"visibility="internal" />
<!-- Default mappings of exported symbols -->
<mapstruct=".*"group="MyGroup.Types" />
<mapfunction="(.*)"group="MyGroup.Functions"name="$1"dll=""somelibrary"" />
<!-- Overrides for specific function parameters and return types -->
<mapfunction="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.
The text was updated successfully, but these errors were encountered:
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
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 thea_specific_function
"Callable", but it looks likeRule.MappingType
is simply not used for functions. I found where it is applied for in lines 125-130 ofMethodTransform.cs
but for some reason it isn't sticking, or is getting reset somewhere. I set a breakpoint on line 142 ofInteropSignatureTransform.cs
and the value ofcallable.ReturnValue
that gets passed toGetInteropTypeForReturnValue
is 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.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 tofalse
and notnull
, it causes thename="$1"
attribute on the firstfunction
mapping to have no effect ona_specific_function
due to line 122 inCppElement.Extensions.cs
, and the default naming rules are applied instead.The text was updated successfully, but these errors were encountered: