Challenge: Marshalling a jobjectArray from JNI




Hi everyone,

I have got a DLL file which has been badly affected to be accessed from a
java application (using JNI).

I need to use this file in my .NET application, but canont modify it.


I already could P/Invoke successfully (it seems) the two first methods of
signature: void mymethod();

The problems come with the last one, which return an object of type
jobjectArray (it is an array of java strings). Do you have any idea how I
can declare that in my P/Invoke code in C# ? I guess a simple string[] won't
do..

Below is the .h of the DLL

Your help will be greatly appreciated!
Thanks a lot,

Lionel Reyero


/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_placelab_spotter_WiFiSpotter */

#ifndef _Included_org_placelab_spotter_WiFiSpotter
#define _Included_org_placelab_spotter_WiFiSpotter
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: spotterAvailable */
/* Inaccessible static: spotterInitialized */
/* Inaccessible static: numInitialized */
/*
* Class: org_placelab_spotter_WiFiSpotter
* Method: spotter_init
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_placelab_spotter_WiFiSpotter_spotter_1init
(JNIEnv *, jobject);

/*
* Class: org_placelab_spotter_WiFiSpotter
* Method: spotter_shutdown
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_placelab_spotter_WiFiSpotter_spotter_1shutdown
(JNIEnv *, jobject);

/*
* Class: org_placelab_spotter_WiFiSpotter
* Method: spotter_poll
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL
Java_org_placelab_spotter_WiFiSpotter_spotter_1poll
(JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif

.



Relevant Pages