On Nov 12, 2007, at 9:29 PM, Richard Otero wrote:
To take one example from the classes above, GtsSurfaceClass, the
function I would be using to create the first argument "klass" is:
GtsSurfaceClass* gts_surface_class(void);
As Albert suggested, use Pointer or PointerType if you don't need
access to the internals of the structure.
---------- GtsSurfaceClass is a struct defined as ---------------
typedef struct {
GtsObjectClass parent_class;
void (* add_face) (GtsSurface *, GtsFace *);
void (* remove_face) (GtsSurface *, GtsFace *);
} GtsSurfaceClass;
---------------------------------------------------------------------
I don't need to access the functions within GtsSurfaceClass so would I
just create a class called GtsSurfaceClass that extends Structure like
so?
public class GtsSurfaceClass extends Structure { }
Do I have to include the functions that I believe I would need a
Callback for?
You need to include them, but you can use "Pointer" or "Callback" as
a placeholder.
Should you need to access these functions, you would declare an
interface deriving from Callback which has a single method called
"callback" which has the same signature as the function pointer. JNA
will automatically handle generation of an interface object for that
field when you get the structure back from a function call.