A solution is to create a new cli::array of the size of your jintArray and then use a for to set all elements to the new array and pass that to c# function.
Pass C++ jintArray to C# function
-
28-06-2023 - |
Question
i have C# dll which has a function
public static Int32[] remDup(Int32[] dArray){
return dArray.Distinct().toArray();
}
i have jni function for this
JNIEXPORT remDup..... ( jintArray dupArray){
// from java call i get dupArray
CsharpDLL::CSharpClass::remDup(/*pass an int32 array */)
}
i have java function which calls below function using jni
remDup (Int[] array)
i m calling C# DLL from Java using C++ wrapper... i have already spent half of the day to find out to pass jIntArray to C# dll function ... but no success.. with complete R&D as much as i can doo..
differet techniques
i.e array<System::Int32^)^ array, Marshal techniques
but still unable to pass array from C++ (JintArray) to C# DLL .. plz help or guide
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow