Skip to content

[jnimarshalmethod-gen] Finish support of delegates for methods with 15+ parameters #709

@radekdoulik

Description

@radekdoulik

Commit 857b9a9 introduced the support of 15+ parameters methods. The changes in jnimarshalmethod-gen are incomplete though and we end up with a generated code, which uses reflection to get a type, which doesn't exist.

Like the generated code here (from Mono.Android-JniMarshalMethods.dll):

    IL_0122:  ldstr      "Delegate18$1"
    IL_0127:  ldc.i4.1
    IL_0128:  call       [mscorlib]System.Type [mscorlib]System.Type::GetType(string, bool)

It happens, because the Delegate18$1 type is created by SLE on the fly and exists in memory only. jnimarshalmethod-gen doesn't know about that yet.

We need to save the in-memory-only type to our marshaling class and change the name to reflect the parameter types.

Currently the in-memory-only type is placed in Snippets assembly. An example:

assembly qualified name: Delegate18$1, Snippets, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
the delegate:            lambda (__jnienv, __class, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth) => {var __envp;var __jvm; ... }

We should save the type from the example to the assembly containing the marshaling __<$>_jni_marshal_methods class and name it something like __<$>_JniMarshal_PPIIIIIIIIIIIIIII_V or maybe to be more consistent as __<$>_jni_marshal_PPIIIIIIIIIIIIIII_V. And also update the generated code to use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    callable-wrappersIssues with Java Callable Wrappers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions