

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
6 messages in net.java.dev.jna.usersno values read after call from a str...| From | Sent On | Attachments |
|---|---|---|
| Kratzer, Heinrich | Oct 25, 2007 12:35 pm | |
| Timothy Wall | Oct 25, 2007 3:14 pm | |
| Kratzer, Heinrich | Oct 26, 2007 2:02 am | |
| Kratzer, Heinrich | Oct 26, 2007 3:43 am | |
| Timothy Wall | Oct 26, 2007 5:24 am | |
| Timothy Wall | Oct 26, 2007 5:28 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | no values read after call from a structure with bytebuffer inside | Actions... |
|---|---|---|
| From: | Kratzer, Heinrich (Hein...@gematik.de) | |
| Date: | Oct 25, 2007 12:35:49 pm | |
| List: | net.java.dev.jna.users | |
Hallo,
The function i use from native library takes as first argument a pointer to a structure, as second a callback function, ... . It looks like this: /**
* ID3BIO_EXPORTS_API DWORD __cdecl GetImage(
* STImage* pstImage,
* LPID3BIO_STATUS_ROUTINE lpUpdateFunc,
* PVOID pvUpdateContext,
* LPID3BIO_COMPLETION_ROUTINE lpCompletionRoutine,
* PVOID pvCompletionContext);
*/
int GetImage(
Pointer pstImage,
LPID3BIO_STATUS_ROUTINE lpUpdateFunc,
Pointer pvUpdateContext,
LPID3BIO_COMPLETION_ROUTINE lpCompletionRoutine,
Pointer pvCompletionContext);
pstImage is a pointer to the structure, which should receive the data. After completion the function calls assynchron the callback function 'lpUpdateFunc', which works really fine. Using the context i can access the structure. But i can not access any new data (The data seem to be unchanged, but they are definitly not). When i preset the buffer bevor call with 'FF' the VM crashes. The behaviour is a little bit unpredictable, sometimes 'GetImage' returns an error, sometimes VM crashes or nothing happens. What i make wrong?
Here the structure: /** * typedef struct * { * // pixels buffer : must be allocated by the caller * BYTE* pbyBuffer; * * // Number of columns * WORD wNbCol; * * // Number of Rows * WORD wNbRow; * * // pixels buffer size (in bytes) : must be initialized by the caller to IMAGE_SIZE * DWORD dwBufferSize; * * } STImage, *PSTImage; */ public class STImage extends Structure { /** pixels buffer : must be allocated by the caller */ // public byte[] pbyBuffer = new byte[IMAGE_SIZE]; public byte[] pbyBuffer;
/** Number of columns */ public short wNbCol;
/** Number of Rows */ public short wNbRow;
/** pixels buffer size (in bytes) : must be initialized by the caller to IMAGE_SIZE (public final int IMAGE_SIZE = (int)128400) */ public int dwBufferSize;
public STImage() { super(Structure.CALCULATE_SIZE, Structure.ALIGN_MSVC);
pbyBuffer = new byte[IMAGE_SIZE]; dwBufferSize = pbyBuffer.length;
// allocateMemory(dwBufferSize + 2 + 2 + 4); allocateMemory();
// // preset buffer for diagnostics // for (int idx = 0; idx < pbyBuffer.length; idx++) { // pbyBuffer[idx] = (byte)(0xFF & 0xFF); // } } }
Have you any idea?
Thanks in advance for your help,
Heinrich.







