Unions in Swig

H

hemanth

Hi

I am required to build a stub to access C API's from Java. For that
purpose I have used Swig to generate the wrapper code.

One of my structures contain "union" as a field. Now the generated
wrapper provides a get() method to access the union in Java, but there
is no set() method to assign a value. Can anybody suggest me about a
workaround either using Swig or in plain Jni.. Thanks in advance..


Thanks
Hemanth
 
R

Roedy Green

One of my structures contain "union" as a field. Now the generated
wrapper provides a get() method to access the union in Java, but there
is no set() method to assign a value. Can anybody suggest me about a
workaround either using Swig or in plain Jni.. Thanks in advance..

If you are going to manipulate it from java you will need two setter
methods , as if the fields were disjoint, and you will need a getter
method to tell you with version is in there. If you don't have them
in C, you will need to write them.
 

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

[ANN] ffi-swig-generator 0.3.0 0
[ANN] ffi-swig-generator 0.2.1 0
Leading padding in unions 25
[ANN] SWIG 1.3.37 0
properly using unions. 9
SWIG 0
python/swig 0
Unions Redux 26

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top