[Mono-list] Embedded API: calling explicit operators

Mitchell Jonathan mugginsoft at googlemail.com
Thu Sep 5 09:23:19 UTC 2013


On 5 Sep 2013, at 00:01, Robert Jordan <robertj at gmx.net> wrote:
> 
> Assuming that you're using mono_method_desc_search_in_class () for
> method look-ups, there is actually no way to specify the return
> type. You may want to enumerate the methods yourself using
> mono_class_get_methods ().
> mono_method_desc_search_in_class
Thanks for the confirmation. mono_method_desc_search_in_class() is my weapon of choice here.

> 
> However, what makes you think that you need these operators in the
> first place? :) Decimal implements a full set of ToXyz methods which
> are more readable and accessible from unmanaged code. IConvertible
> is implemented as well…
I am auto generating code via reflecting on the mscorlib binary.
These overloaded  explicit operator methods are the troublesome offspring of that.
I agree that they are not essential: curiosity was the main driver here.

Given my reliance on mono_method_desc_search_in_class() I now evaluate the signatures of all methods for their overload status.
If a method is over-overloaded (i.e.: the method parameter types match and only the return type differs, or worse, a dupe) then I throw up my hands in despair and omit the method from the binding.

see:
https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/dotNET/CodeGenerator/Dubrovnik.CodeGeneratorEngine/CodeFacet.cs#L557-L573

Thanks

Jonathan



More information about the Mono-list mailing list