Link to home
Start Free TrialLog in
Avatar of kesavan_sridhar
kesavan_sridhar

asked on

Native method problem

Hi

I have a c language method that returns a pointer to struct (defined in c file) and
I want to use this c language to receive the value of the members of the structure
returned by the 'C' function.I cant use pointers in java.So how could I use the c function
to get the values of the struct returned by the 'C' function

Thanks sridhar
Avatar of falter
falter

You have to write a wrapper which converts the pointer to an Java Object

The wrapper calls the C-function
- getting the data from the struct
- creating a Java Object
- putting the data into the attributes of the Java object
- return this object to the JVM
Avatar of kesavan_sridhar

ASKER

To Falter

Helo
Thanks for your response, but is it required to have dependent methods of
a c method to be declared as native method? I mean, if I have a abc() method
of c which I use as a native method
and this abc() method calls some xyz()
method in the c file should I
declare xyz() also as native method
in java file .please explain.


Thanks sridhar
de

ASKER CERTIFIED SOLUTION
Avatar of falter
falter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much falter
Bye

sridhar