2 messages in net.java.dev.jna.userscallbacks
FromSent OnAttachments
Daniel HorowitzJun 14, 2007 7:30 pm 
Timothy WallJun 15, 2007 4:48 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:callbacksActions...
From:Daniel Horowitz (dani@gmail.com)
Date:Jun 14, 2007 7:30:39 pm
List:net.java.dev.jna.users

So im trying to implement callbacks to java functions and I have the honor of writing my own dll any which way I like. The problem is that my dll depends on another dll which accepts a group of callbacks as a struct. How should my C function signature look to accept Java callback methods? Should it be

int consume_callbacks(void *one, void *two, void *three)?

where one two and three are java functions?

I am running in to a wall here because the example uses a predefined callback (WNDENUMPROC lpEnumFunc) type which you overide with an interface (interface WNDENUMPROC extends StdCallCallbac). Should I simulate that instead, and typedef three different types based on void*, then re-create those as interfaces in java with callback methods?

ie

// C code typedef void* one; typedef void* two; typedef void* three;

int consume_callbacks(one my_one, two my_two, three my_three)

//Java code interface one extends Callback { boolean callback(); }

Dan