On Sep 18, 2008, at 2:04 PM, Stas Oskin wrote:
Any idea on the below, and what I'm doing wrong?
Stas, you need to figure out the following:
1) is sharedMemoryPointer a bogus value?
2) if so, when did it become bogus?
3) look at what happened to make it become bogus
Where is the structure created? How many threads access it?
As a matter of style, if you want to initialize a structure from a
Pointer, you should do it in the constructor.
How many shared memory blocks (and these structures mapped onto them)
are you using?
Regards.
---------- Forwarded message ----------
From: Stas Oskin <stas...@gmail.com>
Date: 2008/9/18
Subject: Re: [jna-users] JNA problems when working with shared memory
To: use...@jna.dev.java.net
Hi.
Looks like your VZFrame overrides useMemory (both signatures), then
calls super.useMemory (in both).
Here is the structure I defined to read from shared memory:
public class VZFRAME extends Structure{
public int lRowNumber;
public boolean bCleanCommit;
@Override
protected void useMemory(Pointer m)
{
super.useMemory(m);
super.read();
}
@Override
protected void useMemory(Pointer m, int offset) {
super.useMemory(m, offset);
super.read();
}
}
If you're calling VZFrame.useMemory explicitly, why? What does the
"getRowNumber" code look like around line 83?
I had to to access the useMemory, which is a protected protected
member. Is there any other way to do it?
Here is the getRowNumber():
public int getRowNumber()
{
data_struct.useMemory(sharedMemoryPointer);
return data_struct.lRowNumber;
}
Thanks for your help.