On Feb 18, 2008, at 3:59 PM, Daniele Dellafiore wrote:
Hi.
It is the very first time I use jna, I would like to ask some tip to
start writing.
I have made a test like this:
Gpod gpod = (Gpod) Native.loadLibrary("libgpod.so.3.0.0",
Gpod.class);
You can simply use "gpod" as the library name. JNA will figure out
the rest and use the most recent version available.
assertNotNull(gpod);
and it passes so I am able to load the library and map it in a
interface that extends Library.
That interface class is empty. As you can see I Am trying to map
libgpod library. I cannot find online doc, I'll attach to this email.
I need some tip on how to create the Java class, for example the
native method:
Itdb_iTunesDB* itdb_new (void);
how should be mapped? And there is the structure, Itdb_iTunesDB,
should I map it in:
class Itdb_iTunesDB extends Structure {
...
}
and that structure should be in Gpod.class? Or where?
If you don't need to access the contents of the structure, just
declare it as a PointerType or Pointer. If you *do* need to access
structure fields, simply declare structure fields of the same order
and size as the native declaration. The Javadoc overview page details
many specifics of JNA usage.