Define a swig interface file for generation of wrapper to every type from some header file

Posted by Dmitriy Matveev on Stack Overflow See other posts from Stack Overflow or by Dmitriy Matveev
Published on 2010-05-05T10:50:49Z Indexed on 2010/05/07 1:08 UTC
Read the original article Hit count: 310

Filed under:
|
|

Hi! We're using some C library in our Java project. Several years ago some other developer which has retired few years ago (as always) has created all the wrappers for us. The wrappers were generated by the swig, but the interface file is lost now.

The basic idea of library and the wrappers for it is following:

  • There only one function which returns pointer to some complex object. And there are wrapper for that function.
  • The complex object is a tree-like structure with dozens of node kinds and types (C structures) used to represent them. There are hundreds of wrappers for every field of every type and we're trying to use them all.

The library was updated some time ago and now there are some new data we unaware of which yet, but would like to use. This data is contained in some of the objects indirectly contained or referenced from the object created by the function we call (Some new fields and types were added).

I know that I shouldn't make any changes to the wrappers by hand and should rather modify the interface, but as I already wrote it's missing. For now I only want to generate wrappers some few types which are added/changed and them to our old wrappers, but later I want to start creation of interface file which will define "what and how should be wrapped".

All the definitions necessary for us are defined in single header file. Is it possible to tell swig to generate wrappers for every type in this header? If so, how can I write such interface file?

© Stack Overflow or respective owner

Related posts about swig

Related posts about java