Hey folks. I've managed to work through most of the problem's I'm hit
with JNA so far, but I'm a little stuck on this one.
I need to interface with a camera, which has a DLL interface. Here's the
function I need to use:
//////// C code
TRgbPix* SMXM7X_API CxBayerToRgb(void *BayerMatrix, int ScW, int ScH,
int AlgId, TRgbPix *Frame);
////////
My java mapping:
TRgbPix CxBayerToRgb(byte[] BayerMatrix, int ScW, int ScH, int AlgID,
TRgbPix[] Frame);
And pertinent struct:
///// C code
typedef struct _TRgbPix {
BYTE b;
BYTE g;
BYTE r;
} TRgbPix;
///////////
The Java version of that struct I am using is:
public static class TRgbPix extends Structure {
public static class ByValue extends TRgbPix implements
Structure.ByValue { }
public byte b;
public byte g;
public byte r;
}
I'm invoking it as:
byte[] buffer = new byte[100];
// Some stuff here to fill buffer
TRgbPix[] frameOut = new TRgbPix[100];
SMXLibrary.INSTANCE.CxBayerToRgb(buffer, 10, 10, 2, frameOut);
The problem I get is a 10 second hang, followed by:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
etc
I'm fairly sure that it's not some silly indexing / row&column problem,
as in using the function incorrectly. In the C code, the buffer is a
BYTE array.
Any ideas? I'm not sure what to do about the void * type being an
argument, when it supposed to be a byte array.
Thanks,
Andrew