JNI ready for testing. -fPIC enabled for objects in src and jni.
This commit is contained in:
parent
1529c0641e
commit
106b8bb6a7
25 changed files with 954 additions and 145 deletions
30
jni/NOTES
30
jni/NOTES
|
|
@ -1,12 +1,26 @@
|
|||
Compilation:
|
||||
javac com/upstandinghackers/hammer/*.java
|
||||
USING THE JNI BINDINGS:
|
||||
1. import com.upstandinghackers.hammer.*;
|
||||
2. Add a static initializer block that loads the correct library, like this: static { System.loadLibrary("jhammer"); }
|
||||
3. Code stuff. Just look at Example.java for a few handy snippets (for walking the resulting syntax tree [AST] etc)
|
||||
4. Compile your java sources like always
|
||||
5. Add the folder containing libhammer.so/dll/whatever to Java's library path to run it, for example: java -Djava.library.path=. <CLASS>
|
||||
|
||||
Conversion to JNI headers:
|
||||
find -name "*.class" | sed -e 's/.class$//' | tr '/' '.' | cut -c 3- | xargs javah
|
||||
|
||||
Not working:
|
||||
enums aren't converted at all, no idea why
|
||||
UNIMPLEMENTED:
|
||||
User-defined types, predicates and actions are unimplemented.
|
||||
Memory leaks because there is no reliable garbage collection.
|
||||
|
||||
TODO:
|
||||
Implement the entire JNI side
|
||||
Testing
|
||||
|
||||
|
||||
TYPE MAPPING:
|
||||
Hammer Java JNI
|
||||
uint8_t byte jbyte jbyte/byte is signed
|
||||
char byte jbyte jchar would be 16 bit wide
|
||||
size_t int jint signed as well; jsize == jint, actually
|
||||
int64_t long jlong
|
||||
uint64_t long jlong signed!
|
||||
bool boolean jboolean JNI_TRUE / JNI_FALSE
|
||||
float float jfloat
|
||||
double double jdouble
|
||||
void void void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue