function pointer in JNI

K

Kay

Hello, all:

The c library I am using requires passing in a pointer to a user defined
function. I am wondering how to wrap that in JNI. Any help will be
appreciated. Thanks,

-Kay
 
G

Gordon Beaton

The c library I am using requires passing in a pointer to a user
defined function. I am wondering how to wrap that in JNI. Any help
will be appreciated. Thanks,

Wrap what, exactly? As given, your question is rather too vague to
answer without writing an essay on all the potential variations you
could mean. Provide a concrete example, and describe what you're
having problems with.

That said, obviously you have to pass it a pointer to a regular C
function that is visible where you call the c library function:

static int some_function(void)
{
// do stuff
return 0;
}

my_native_method(JNIEnv *env, jobject this)
{
/* pass the function pointer */
c_library_function(some_function);
}

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,260
Messages
2,571,038
Members
48,768
Latest member
first4landlord

Latest Threads

Top