Binding non-trivial C++ examples using CxxWrap.jl

I am trying to write Julia bindings for a C++ library with types that depend on other types. It is unclear from the CxxWrap.jl docs or examples how to deal with this case. An example of the interdependent C++ structs are below:

struct CsgTreeNode {
    int child1, child2;
    bool isLeafChild1, isLeafChild2;
    BooleanOperation operation;
};

enum class BooleanOperation {
    Union,
    Intersection,
    Difference,
    None
};

We tried using map_type and defining the matching Julia structs before wrapmodule, but this didn’t know about the C++ BooleanOperation at that point in the code. We then tried wrapping things one type at a time, but there were not exposed macros for that. We then tried add_type, but CsgTreeNode has no methods or constructors, so it failed to compile.

2 Likes