views:

118

answers:

1

I'm currently trying to access a C API using JNA. But I have a problem with unsigned integer parameters that are being passed by reference.

So here is the C function in question:

int EE_DataGetNumberOfSample(DataHandle hData, unsigned int* nSampleOut);

In Java I have:

public int EE_DataGetNumberOfSample(Pointer hData, ByReference nSampleOut);

And here's how I'm using it:

IntByReference nSamplesTaken = new IntByReference();

edk.EE_DataGetNumberOfSample(hData.getValue(), nSamplesTaken);

int nativeNSamplesTaken = nSamplesTaken.getValue();

System.out.println(Integer.toBinaryString(nativeNSamplesTaken)+"("+nativeNSamplesTaken+")");

This gives me:

11000100110110010011000000(51602624)

Altough it should be 0.

Is there something wrong with the way I'm using the JNA-API?

Thank you!

A: 

To answer my own question:

There's nothing wrong with the code snippets I posted here, but there was another completely unrelated error that has nothing to do with the question.

[closed]

André Hoffmann