Hi Timothy,
Use NativeLibrary.getGlobalVariableAddress(String name). This will
give you a pointer to the value, so you'll need to use
Pointer.getXXX(0) to obtain the actual value of the "constant".
Thanks a lot!
But how I can get from the Pointer to a Structure subclass? Here's
what I have by now:
public class CFDictionaryKeyCallBacks extends Structure {
public int version;
public CFDictionaryRetainCallBack retain;
public CFDictionaryReleaseCallBack release;
public CFDictionaryCopyDescriptionCallBack copyDescription;
public CFDictionaryEqualCallBack equal;
public CFDictionaryHashCallBack hash;
public CFDictionaryKeyCallBacks(
int version,
CFDictionaryRetainCallBack retain,
CFDictionaryReleaseCallBack release,
CFDictionaryCopyDescriptionCallBack copyDescription,
CFDictionaryEqualCallBack equal,
CFDictionaryHashCallBack hash) {
super();
this.version = version;
this.retain = retain;
this.release = release;
this.copyDescription = copyDescription;
this.equal = equal;
this.hash = hash;
}
// callbacks
public interface CFDictionaryRetainCallBack extends Callback {
CFType callback(CFAllocator allocator, CFType value);
}
// ...
public static CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks
() {
NativeLibrary nativeLib = NativeLibrary.getInstance
(CoreFoundationLibrary.LIBRARY_NAME);
Pointer pointer = nativeLib.getGlobalVariableAddress
("kCFTypeDictionaryKeyCallBacks");
CFDictionaryKeyCallBacks result = ?????
return result;
}
// ...
}
Thanks again for your help and for JNA in general... :)
Timo