# Best current option for C++ interop?

**URL:** <https://discourse.julialang.org/t/best-current-option-for-c-interop/56186>\
**Category:** General Usage\
**Created:** [February 28, 2021, 12:12pm UTC](https://discourse.julialang.org/t/best-current-option-for-c-interop/56186 "2021-02-28T12:12:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [February 28, 2021, 12:12pm UTC](https://discourse.julialang.org/t/best-current-option-for-c-interop/56186/1 "2021-02-28T12:12:41Z")

</div>

[Cxx.jl](https://github.com/JuliaInterop/Cxx.jl) does not support Julia 1.5. What’s the best option calling using C++ libraries? Should I use (plain) C as the bridge?

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [February 28, 2021, 12:15pm UTC](https://discourse.julialang.org/t/best-current-option-for-c-interop/56186/2 "2021-02-28T12:15:39Z")

</div>

I don’t know how good it is but there is [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl).

---

<div class="post-metadata">

**Author:** ![Iulian.Cioarca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iulian.cioarca/32/30166_2.png) [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Post date:** [February 28, 2021, 12:51pm UTC](https://discourse.julialang.org/t/best-current-option-for-c-interop/56186/3 "2021-02-28T12:51:43Z")

</div>

CxxWrap is cool but kind of painful to set up. In the past I ended up writing an extern C wrapper, compiled it in a dll and then used Julia’s native C calling. I would say for some tasks it’s less effort and more robust since you rely on the native Julia C interop. For me it worked because I didn’t need to use objects, I could simply expose methods and do my job. Ymmv

---

<div class="post-metadata">

**Author:** ![groot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/groot/32/13081_2.png) [@groot](https://discourse.julialang.org/u/groot)\
**Post date:** [March 3, 2021, 7:10am UTC](https://discourse.julialang.org/t/best-current-option-for-c-interop/56186/4 "2021-03-03T07:10:02Z")

</div>

Similar to [Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)’s approach. I write a thin c wrapper layer called by ccall for C++ code. It works great and is very stable across Julia versions. I also tried Cxx and CxxWrap. I would say they are still kinda in their early stage. CxxWrap has gone through plenty of progress recently though. But I would still choose julia’s C call now.
