[UnmanagedCallersOnly(EntryPoint = "{{ ffi_name }}")]
internal static {{ rval_type }} {{ ffi_name }}({{ args }})
{
try
{
var handle = GCHandle.FromIntPtr(self);
var obj = (I{{ type_name }}<{{ type_name }}>)handle.Target!;
{%- if is_void %}
obj.{{ method_name }}({{ forward }});
{%- elif result_wrap_type %}
return {{ result_wrap_type }}.FromCall(() => obj.{{ method_name }}({{ forward }})){{ rval_suffix }};
{%- elif result_passthrough_type %}
return {{ result_passthrough_type }}.FromCallResult(() => obj.{{ method_name }}({{ forward }})){{ rval_suffix }};
{%- else %}
return obj.{{ method_name }}({{ forward }}){{ rval_suffix }};
{%- endif %}
}
catch (Exception e)
{
Trampoline.UncaughtException(e.ToString());
{%- if not is_void %}
return default;
{%- endif %}
}
}