3 messages in net.java.dev.jna.usersRe: [jna-users] Attempting to access ...
FromSent OnAttachments
Richard OteroNov 12, 2007 6:29 pm 
Albert StrasheimNov 12, 2007 8:32 pm 
Timothy WallNov 13, 2007 5:37 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Attempting to access GNU Triangulated Surface Library through JNAActions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 13, 2007 5:37:02 am
List:net.java.dev.jna.users

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.