0

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

5
  • This may help msdn.microsoft.com/en-us/library/dtbydz1t.aspx Commented Apr 6, 2014 at 20:09
  • @Bogdan thnx dude! BUT its giving following ERROR a value of type "cli::array<int,1>^" cannot be used to initialize an entity of type "cli::array<System::Int32^,1>^ " Commented Apr 6, 2014 at 20:14
  • Sorry, not familiar with jintArray, but worst case solution is to create a new cli::array<int> 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 ... Commented Apr 6, 2014 at 20:16
  • @Bogdan thanx dude, your link was helpful to me ... if you can properly answer above comment as answer.. i can marked it as answer :) Commented Apr 7, 2014 at 11:36
  • 3
    Added as answer, I do not chase points but some may search that question on google and it will be useful to them ;) Commented Apr 7, 2014 at 17:48

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.