[Cffi-devel] How do I wrap a C/C++ struct with a nested union

Joeish W joeish80829 at yahoo.com
Tue May 27 20:29:03 UTC 2014


I'm trying to wrap this struct, CvDTreeSplit. Normally I just use swig to wrap them but in this case when I wrap the C++ struct, CvDTreeSplit, below, I get this error in swig:

 Warning 312: Nested union not currently supported (ignored).

So the output ends up being the defcstruct at the bottom of the page.  Not sure where to go from here. Can someone wrap this struct for me so I'll know how to wrap structs, with nested unions, containing structs and C arrays, in the future.


struct CvDTreeSplit
{
    int var_idx;
    int condensed_idx;
    int inversed;
    float quality;
    CvDTreeSplit* next;
    union
    {
        int subset[2];
        struct
        {
            float c;
            int split_point;
        }
        ord;
    };
};

(cffi:defcstruct CvDTreeSplit
    (var_idx :int)
    (condensed_idx :int)
    (inversed :int)
    (quality :float)
    (next :pointer))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140527/7edb17c4/attachment.html>


More information about the cffi-devel mailing list