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 trying to bind a library that has a dependency on this other library JNA (version 5.13.0) but when adding the JNA .jar file and set it as Bind=False on the csproj I'm getting one error regarding multiple interfaces having the same method, so basically it's like this:
As you can see, both interfaces have Class<?> nativeType() and that's why the ITypeConverter fails when compiling the binding project:
The call is ambiguous between the following methods or properties: 'IFromNativeConverter.NativeType()' and 'IToNativeConverter.NativeType()'
On the generated code, it would be this:
staticIntPtrn_NativeType(IntPtrjnienv,IntPtrnative__this){var__this=global::Java.Lang.Object.GetObject<global::Com.Sun.Jna.ITypeConverter>(jnienv,native__this,JniHandleOwnership.DoNotTransfer)!;returnJNIEnv.ToLocalJniHandle(__this.NativeType());// Here THE ERROR}
Attempted non-working solutions
I attempted to create a new IBaseNativeConverter in C# binding project with that method and remove the nodes from the two aforementioned interfaces and then just let IFromNativeConverter and IToNativeConverter implement IBaseNativeConverter so we have the method in just one interface but then I get an error saying that the {From|To|Type}NativeConverterInvoker does not implement my C# Java.Lang.Class? NativeType() method.
Question
Should I implement a similar call like the above that was throwing an error on each ...Invoker?
Or what can I do to fix this without changing the library java source code?
And btw, I had to remove the node for JNIEnv since that's being used by the Xamarin binding generator and was causing some problems on binding the lib.
Also, I attempted to create a separate binding project for JNA only and ended up with the same errors.
The text was updated successfully, but these errors were encountered:
If you don't use the method nativeType(), you could try removing it from one or both of the interfaces.
If you aren't trying to consume or implement either interface, you could remove the whole interface types, or remove TypeConverter.
You could try renaming one of the methods with managedName to something like nativeType2().
jpobst
added
question
Item is a user question, and should not involve a coding change
generator
Issues binding a Java library (generator, class-parse, etc.)
labels
Jan 8, 2024
Problem
I'm trying to bind a library that has a dependency on this other library JNA (version 5.13.0) but when adding the JNA
.jar
file and set it asBind=False
on the csproj I'm getting one error regarding multiple interfaces having the same method, so basically it's like this:As you can see, both interfaces have
Class<?> nativeType()
and that's why theITypeConverter
fails when compiling the binding project:On the generated code, it would be this:
Attempted non-working solutions
I attempted to create a new
IBaseNativeConverter
in C# binding project with that method and remove the nodes from the two aforementioned interfaces and then just letIFromNativeConverter
andIToNativeConverter
implementIBaseNativeConverter
so we have the method in just one interface but then I get an error saying that the{From|To|Type}NativeConverterInvoker
does not implement my C#Java.Lang.Class? NativeType()
method.Question
Should I implement a similar call like the above that was throwing an error on each
...Invoker
?Or what can I do to fix this without changing the library java source code?
Notes:
Here you have the
Metadata.xml
:And btw, I had to remove the node for
JNIEnv
since that's being used by the Xamarin binding generator and was causing some problems on binding the lib.Also, I attempted to create a separate binding project for JNA only and ended up with the same errors.
The text was updated successfully, but these errors were encountered: