JNAerator v0.8 (build 461) : nicer with structs, better with ObjectiveC frameworks
Launch JNAeratorStudio via Java Web Start
Here are the main changes in this new version of JNAerator, the automatic C/ObjectiveC -> Java wrappers generator :
- Fixed error display of “skipped” extern const int x; that was not actually skipped.
- Ensure JNAerated NSObject, NSClass, NSString & FoundationLibrary have all the methods that are declared in the manual-declared versions shipping in Rococoa-core.
- Added experimental JNA direct call support (“-direct” switch in command line or config files).
- Creates structures in separate files, not in library class anymore (unless switch “-structsInLibrary” is used).
- In command line, try to pick arguments from local file config.jnaerator if no argument is provided.
- Write runtime classes in output JAR (not fixed yet, will eventually create truly self-contained JARs).
- Now including ecj (eclipse’s batch compiler) in jnaerator.jar (it used to be linked from the jnlp file only, but javac does not seem to scale well enough for large JNAerated sources).
- Added field values constructors for structures and unions (with check that array fields have expected size).
- Removed copy & pointer+offset structure constructors, somehow replaced by methods clone(), byReference(), byValue().
As a result, the following code :
struct S {
int i;
float f; // comment about f
S* next;
};
union U {
int i;
float f; // comment about f
void* p;
};
Will now be JNAerated this way :
public class S extends com.sun.jna.Structure {
public int i;
/// comment about f
public float f;
public test.S.ByReference next;
public S() {
super();
}
/// @param f comment about f
public S(int i, float f, test.S.ByReference next) {
super();
this.i = i;
this.f = f;
this.next = next;
}
public ByReference byReference() {
ByReference s = new ByReference();
s.useMemory(getPointer());
write();
s.read();
return s;
}
public ByValue byValue() {
ByValue s = new ByValue();
s.useMemory(getPointer());
write();
s.read();
return s;
}
public S clone() {
S s = new S();
s.useMemory(getPointer());
write();
s.read();
return s;
}
public static class ByReference extends S implements com.sun.jna.Structure.ByReference {}
public static class ByValue extends S implements com.sun.jna.Structure.ByValue {}
}