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

**URL:** https://discourse.julialang.org/t/binding-non-trivial-c-examples-using-cxxwrap-jl/119228
**Category:** General Usage
**Tags:** cxxwrap
**Created:** [September 9, 2024, 9:31pm UTC](https://discourse.julialang.org/t/binding-non-trivial-c-examples-using-cxxwrap-jl/119228 "2024-09-09T21:31:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bthorne93](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bthorne93/32/19570_2.png) [@bthorne93](https://discourse.julialang.org/u/bthorne93)
#### Post date: [September 9, 2024, 9:31pm UTC](https://discourse.julialang.org/t/binding-non-trivial-c-examples-using-cxxwrap-jl/119228/1 "2024-09-09T21:31:56Z")

</div>

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:

```julia
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.
