Hello,
I have tow functions in C:
void fct1(int rank, float * limit);
void fct2(int rank, float limit);
the fct1 will give a value to limit which will be used in fct2
In java, I've called them this way (the fct1 will be: void fct1(int rank,
DoubleByReference limitRef) and the fct2: fct2 (int rank, float limit))
int rank=0;
fct1(rank, limitRef)
Pointer limitPtr=limitRef.getPointer();
float limit=limitPtr.getfloat(0);
System.out.println(limit); //to verify the value of limit
rank=0;
fct2(rank, limit);
Using this I had 2 problems:
1- I've checked the value that are passed to the C function (by adding a printf
in the C code):
for the first function, everything is OK.
the value of limit is the same in the fct1 printf and the System.out.println in
java
But the printf in fct2 code is different
2- the same for rank (which is just read in both functions)
for fct1 it has the same value as in the java code
for fct2, it has the value of an uninitialized int
Have I made a mistake in writing my functions?
Thanks.