pass nested structs through JNI

J

jobs239

I need to pass a nested struct as argument to JNI function e.g.
struct A {
int a
struct B
}

struct B {
long b
struct B * next
}

What is a good way to do this. I think I can use GetFieldID and
SetField for each field but since the structs are big its very
cumbersome.

Should I just pass a string of values and compose this data structure
on the java side. What other options do I have?
 
G

Gordon Beaton

I need to pass a nested struct as argument to JNI function e.g.

struct A {
int a
struct B
}

struct B {
long b
struct B * next
}

What is a good way to do this.

A good way to do *what*?
I think I can use GetFieldID and SetField for each field but since
the structs are big its very cumbersome.

Should I just pass a string of values and compose this data
structure on the java side. What other options do I have?

It's far from clear what you're trying to do exactly. GetFieldID() etc
are for accessing fields in Java objects, but those C structs cannot
be fields in a Java object.

When you say "JNI function", are you referring to native methods,
parts of the JNI API, or C functions in general?

/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

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top