Hi Timothy :-) Thanks again for your response. I am now some steps
ahead. now I can connect with the robot.
NativeLibrary.getGlobalVariableAddress(String) provides you with a
Pointer, which is the address of the variable.
boolean sfIsConnected() {
// assumes sfIsConnected is a 32-bit value
return
Saphira.INSTANCE.getGlobalVariableAddress('sfIsConnected').getInt(0);
}
I had to make a small modification to your proposal in order to make it
work:
--- return
(NativeLibrary.getInstance("SF").getGlobalVariableAddress("sfIsConnected").getInt(0))!=0;
My full Saphira code follows:
public interface Saphira extends Library
{
Saphira INSTANCE = (Saphira)Native.loadLibrary("SF", Saphira.class);
// Optional: wraps every call to the native library in a
// synchronized block, limiting native calls to one at a time
Saphira SYNC_INSTANCE = (Saphira)
Native.synchronizedLibrary(INSTANCE);
public static final int SW_SHOWNORMAL = 1;
public static final int SW_NORMAL = 1;
//....more consts
void sfStartup(HANDLE hInst, int nCmdShow, int async);
void sfOnConnectFn(ConnectInterface cI); //Use a non-native
function pointer (callback)
void sfOnDisconnectFn(ConnectInterface cI); //Use a non-native
function pointer (callback)
//...More functions
}
What should I change so I can use the instruction you propose?
Saphira.INSTANCE.getGlobalVariableAddress('sfIsConnected').get
Instead, do
java -Djna.library.path=c:/saphira/ver62/bin/sh ...
Thanks for the tipp. I am using eclipse, so it is kinda easier now.