On Sun, Jul 7, 2013 at 4:01 PM, Julien Nicoulaud
<
julien.n...@gmail.com> wrote:
> Hi all,
>
> I'm thinking of using HawtJNI to write a Java wrapper for an existing C
> library. I have a few questions regarding type mappings:
>
> Non-struct typedefs
>
> How do I map something like that ?
>
> typedef long my_long;
>
Just map it to a long and optionally cast to a my_long. For example:
@JniArg(cast="my_long") long arg1
>
> Unions
>
> Is union type supported ?
There is no class mapping that can nicely represent a union in java.
Just define multiple structs and memcpy the memory to the struct that
has the layout that you need.
>
> Enums
>
> The library defines enums, used by ordinal:
>
> enum {
> FOO,
> BAR
> };
>
> typedef struct my_struct {
> int enum_value;
> }
>
>
> Is there an smart way to handle this with HawtJNI ?
>
The best you can do is to load the ordinal constants.
See:
http://hawtjni.fusesource.org/documentation/developer-guide.html#platform-constants
> Disable statistics code generation ?
>
> Last thing, I see HawtJNI inserts some pre/post method call code in the
> generated code, I guess this is for the statistics feature. Is it possible
> to disable it (for performance reasons) ?
Not currently. Feel free to send in a pull request that adds an
option to disable that part of the code generation.
>
> Regards,
> Julien
>
> --
> You received this message because you are subscribed to the Google Groups
> "HawtJNI" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
hawtjni+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>
--
Hiram Chirino
Engineering | Red Hat, Inc.
hchi...@redhat.com |
fusesource.com |
redhat.com
skype: hiramchirino | twitter: @hiramchirino
blog: Hiram Chirino's Bit Mojo