JNR examples?

670 views
Skip to first unread message

da...@iq80.com

unread,
Aug 24, 2013, 4:56:37 PM8/24/13
to jvm...@googlegroups.com
I think it might be helpful for the discussion to see some example well written JNR code.  I'm not sure everyone knows how JNR has taken to mapping c types into Java.  I'd like to see some simple things that cleanly map, and some complex stuff that doesn't map well.

-dain

mark roos

unread,
Aug 24, 2013, 7:16:26 PM8/24/13
to jvm...@googlegroups.com


from dain

mark roos

unread,
Aug 24, 2013, 7:20:03 PM8/24/13
to jvm...@googlegroups.com
I would like to see an example of how one could use the JNR assembler plus linker to dynamically
create a 'intrinsic' like method handle as well.  I have quite a bit of complex math that could benefit
from this kind of optimization. (dynamically build a math function)

mark

Wayne Meissner

unread,
Aug 27, 2013, 8:13:56 AM8/27/13
to da...@iq80.com, jvm...@googlegroups.com
There are some (very) minimal examples at
https://github.com/jnr/jnr-ffi-examples. The gettimeofday example
shows how to map in structs, and the qsort one demonstrates C => java
callbacks.

For an example of where mapping starts to get complicated, look at
https://github.com/jnr/jnr-netdb/blob/master/src/main/java/jnr/netdb/NativeServicesDB.java
> --
> You received this message because you are subscribed to the Google Groups
> "jvm-ffi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jvm-ffi+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages