Bonjour

Voici mon problème. J'utilise JNI pour utiliser les ressources d'une librairie C++ avec un code Java. L'implémentation semble bien marcher a une exception près. Voici mon code Java (ne criez pas au scandale !) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
public class Main {
 
	/*The link between our Java program and our library*/
	private native void getLine(int nb, String []prompt);
 
	public static void main(String[] args) {
		Main m = new Main();
		/*How many arguments we have ?*/
		int argv = args.length;
		/*Sending to the library the arguments number and the arguments themselves*/
		m.getLine(argv, args);
	}
 
	/*Loading the library libPCR.so in our $LD_LIBRARY_PATH*/
	static {
        System.loadLibrary("PCR");
    }
 
}
Et le fichier C++ appelé :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
#include "FindPrimers.h"
#include "Main.h"
 
JNIEXPORT void JNICALL Java_Main_getLine (JNIEnv *env, jobject object, jint a, jobjectArray string) {
		//std::cout << "Arguments passés" << std::endl;
		//std::cout << a << std::endl;
		const char *args[a];
		for (int i=0; i<a; i++){
			jstring jstr = (jstring)env->GetObjectArrayElement(string, i);
			const char *c = env->GetStringUTFChars(jstr, 0);
			//std::cout << c << std::endl;
			args[i] = c;
			env->ReleaseStringUTFChars(jstr, c);
		}
		FindPrimers(a, args);
		return;
}
Vous pouvez voir des cout mis en commentaires : ces tests m'ont affiché ce que j'attendais, donc cette partie est correcte. Ce qui ne va pas, c'est l'appel de la méthode FindPrimers. Voici un code minimal de FindPrimers :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
void FindPrimers(int nb, const char *words[]){
	TSetSeq SetSeq,TheoSeq;
  	TScoMat ScoMat;
  	std::cout << "Arguments passés :" << std::endl;
  	std::cout << nb << std::endl;
  	for (int i=0; i<2; i++) {
  		std::cout << words[i] << std::endl;	
  	}
}
A l'affichage, nb est bien affiché mais je n'ai rien dans mon tableau words. Je suppose que j'ai dû mal transmettre ce paramètre.
Où est donc mon erreur ?
Merci d'avance de vos réponses et excusez encore cette incursion d'un Perlien-Javaiste chez vous.

@++