This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Bidimension array of int
- To: java-discuss@sourceware.cygnus.com
- Subject: Bidimension array of int
- From: Eric Gamess <egamess@kanaima.ciens.ucv.ve>
- Date: Thu, 2 Sep 1999 18:33:31 -0700 (PDT)
- Reply-To: Eric Gamess <egamess@kanaima.ciens.ucv.ve>
Hello,
I am trying to work with bidimensional array. I did a simple example.
A Java file called Borrar.java.
////////////////////// Borrar.java //////////////////////////
class Borrar
{
static native void visualizar(int a[][]);
public static void main(String args[])
{
int a[][]={{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}};
visualizar(a);
}
}
//////////////////////////////////////////////////////////////
I did:
gcj Borrar.java
gcjh Borrar
I could see that the method ``visualizar'' have the following prototype
void Borrar::visualizar(jobjectArray, jint);
So, I write the following file (Borrar1.cc).
///////////////// Borrar1.cc ////////////////////////////////
#include <cni.h>
#include <stdio.h>
#include "Borrar.h"
void Borrar::visualizar(jobjectArray a, jint size)
{
int len=JvGetArrayLength(a);
printf("Length: %d\n", len);
}
///////////////////////////////////////////////////////////////
The compilation is OK, but I cannot link ???????
So, I did the file Borrar2.h and modify Borrar.h (change the prototype)
/////////////////// Borrar2.cc ////////////////////////////////
#include <cni.h>
#include <stdio.h>
#include "Borrar.h"
void Borrar::visualizar(JArray<JArray<int> *> *a)
{
int len=JvGetArrayLength(a);
printf("Length: %d\n", len);
}
////////////////////////////////////////////////////////////////
And I could compile, link and run the program.
Why gcjh give me protoype:
void Borrar::visualizar(jobjectArray, jint);
instead of prototype:
void Borrar::visualizar(JArray<JArray<int> *> *);
Is there a way to fix it?
Thank you very much for your help.
Eric.
*******************************************************************
Eric Gamess
Universidad Central de Venezuela
Postgrado de Ciencias de la Computacion
Caracas, Venezuela
E-mail: egamess@kanaima.ciens.ucv.ve
Tel: 605-22-93
*******************************************************************