# \#cxx

**URL:** https://discourse.julialang.org/tag/cxx/86.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Dynamic Type in CxxWrap.jl](https://discourse.julialang.org/t/dynamic-type-in-cxxwrap-jl/133007)

<div class="topic-metadata">

**Author:** [@phK3](https://discourse.julialang.org/u/phK3)\
**Replies:** 1\
**Last updated:** [October 20, 2025, 9:56am UTC](https://discourse.julialang.org/t/dynamic-type-in-cxxwrap-jl/133007 "2025-10-20T09:56:31Z")

</div>

I want to use CxxWrap.jl to create a Julia wrapper for a C++ library. On the Julia side, I want to dispatch on the type of my arguments. But when using CxxWrap, the Julia side only seems to know about the static return…

---

## [Passing an array of tuples to CxxWrap](https://discourse.julialang.org/t/passing-an-array-of-tuples-to-cxxwrap/125392)

<div class="topic-metadata">

**Author:** [@nabla](https://discourse.julialang.org/u/nabla)\
**Replies:** 0\
**Last updated:** [January 30, 2025, 1:49pm UTC](https://discourse.julialang.org/t/passing-an-array-of-tuples-to-cxxwrap/125392 "2025-01-30T13:49:32Z")

</div>

I’d love to pass an array of tuples to some C++ code; say calling myfunction(\[("a",1),("b",2)\]) At the C++ level, I would write a function mod.method("myfunction", \[\](const jlcxx::ArrayRef\<std::tuple\<std::string,int\>\> …

---

## [Passing a Julia struct to a already compiled cpp program](https://discourse.julialang.org/t/passing-a-julia-struct-to-a-already-compiled-cpp-program/124731)

<div class="topic-metadata">

**Author:** [@TheBreadFarmer](https://discourse.julialang.org/u/TheBreadFarmer)\
**Replies:** 1\
**Last updated:** [January 13, 2025, 6:01pm UTC](https://discourse.julialang.org/t/passing-a-julia-struct-to-a-already-compiled-cpp-program/124731 "2025-01-13T18:01:10Z")

</div>

I am writing a program in Julia that reads data from a file into memory. I’d like to take that data and somehow pass it to a c++ program which will make use of OpenGL to draw that data to the screen. I am making use of …

---

## [Can someone provide a simple example of using CxxWrap?](https://discourse.julialang.org/t/can-someone-provide-a-simple-example-of-using-cxxwrap/115908)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [June 21, 2024, 2:44pm UTC](https://discourse.julialang.org/t/can-someone-provide-a-simple-example-of-using-cxxwrap/115908 "2024-06-21T14:44:27Z")

</div>

Hello, I am trying to look at CxxWrap as the super-easy Cxx.jl package seems lost :-((((( However, as my usage of CMAKE is very limited, I am unable to follow even the example in the home page (and there is no separate …

---

## [Define a C++ struct/class in Julia for interop?](https://discourse.julialang.org/t/define-a-c-struct-class-in-julia-for-interop/112766)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 11\
**Last updated:** [April 19, 2024, 1:07pm UTC](https://discourse.julialang.org/t/define-a-c-struct-class-in-julia-for-interop/112766 "2024-04-19T13:07:22Z")

</div>

To efficiently call C or C++ libraries without an additional overhead of dereferencing pointers, you need to define a Julia struct with the same memory layout as the the struct/class in C or C++. For C, Clang.jl and CBin…

---

## [Two ways to get C++ interface class from C API](https://discourse.julialang.org/t/two-ways-to-get-c-interface-class-from-c-api/112522)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 0\
**Last updated:** [April 4, 2024, 1:41pm UTC](https://discourse.julialang.org/t/two-ways-to-get-c-interface-class-from-c-api/112522 "2024-04-04T13:41:09Z")

</div>

Consider simple C++ interface class: ▶ File \`shape.h\` Since Cxx.jl in obsolete, so you cannot generate julia types from C++, and CxxWrap.jl means you have to make changes on C++ side, so I’ve made two C library wrappers …

---

## [Auto cxxwrap generator like autopybind11](https://discourse.julialang.org/t/auto-cxxwrap-generator-like-autopybind11/102225)

<div class="topic-metadata">

**Author:** [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Replies:** 3\
**Last updated:** [July 29, 2023, 6:21pm UTC](https://discourse.julialang.org/t/auto-cxxwrap-generator-like-autopybind11/102225 "2023-07-29T18:21:51Z")

</div>

Is there something like autopybind11 / autopybind11 · GitLab where you define a simple config file and it generates all the code needed for wrapping for you?

---

## [Wrapping of large C++ libraries](https://discourse.julialang.org/t/wrapping-of-large-c-libraries/100114)

<div class="topic-metadata">

**Author:** [@fran94](https://discourse.julialang.org/u/fran94)\
**Replies:** 5\
**Last updated:** [June 9, 2023, 8:36pm UTC](https://discourse.julialang.org/t/wrapping-of-large-c-libraries/100114 "2023-06-09T20:36:30Z")

</div>

Hi, I have seen several packages aiming at wrapping C++ code to use in Julia, such as CxxWrap.jl. I haven’t seen a lot of resources about wrapping large pre-existing C++ libraries. I’m thinking about something of the si…

---

## [With CxxWrap, method cannot return an usable complex number](https://discourse.julialang.org/t/with-cxxwrap-method-cannot-return-an-usable-complex-number/94801)

<div class="topic-metadata">

**Author:** [@gdmsl](https://discourse.julialang.org/u/gdmsl)\
**Replies:** 0\
**Last updated:** [February 17, 2023, 5:57pm UTC](https://discourse.julialang.org/t/with-cxxwrap-method-cannot-return-an-usable-complex-number/94801 "2023-02-17T17:57:42Z")

</div>

Hi, I am trying to use CxxWrap to wrap a C++ library. I am wrapping a type that has a method that returns a std::complex. I have also wrapped the std::complex type, since it is not already in the CxxWrap library. The p…

---

## [CxxWrap can't find .dylib on MacOS](https://discourse.julialang.org/t/cxxwrap-cant-find-dylib-on-macos/86997)

<div class="topic-metadata">

**Author:** [@danny.s](https://discourse.julialang.org/u/danny.s)\
**Replies:** 3\
**Last updated:** [September 12, 2022, 2:41pm UTC](https://discourse.julialang.org/t/cxxwrap-cant-find-dylib-on-macos/86997 "2022-09-12T14:41:53Z")

</div>

I’m working on a C++ package (called MParT) for MacOS and Linux, as well as creating bindings to it in Julia. So far, I’ve had moderate success, where I can use Linux to \]add https://github.com/MeasureTransport/MParT.jl …

---

## [CxxWrap on windows](https://discourse.julialang.org/t/cxxwrap-on-windows/65178)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 7\
**Last updated:** [January 16, 2022, 5:09am UTC](https://discourse.julialang.org/t/cxxwrap-on-windows/65178 "2022-01-16T05:09:13Z")

</div>

Hi, I am trying to use CxxWrap on windows. I am trying to reproduce the “hello world” on the github page. Questions: 1/ where is #include "jlcxx/jlcxx.hpp" ? 2/ how do I compile to a shared library? ( i have gcc) 3…

---

## [Installing ROS.jl error](https://discourse.julialang.org/t/installing-ros-jl-error/74665)

<div class="topic-metadata">

**Author:** [@kobied](https://discourse.julialang.org/u/kobied)\
**Replies:** 3\
**Last updated:** [January 15, 2022, 3:47pm UTC](https://discourse.julialang.org/t/installing-ros-jl-error/74665 "2022-01-15T15:47:13Z")

</div>

Hi, I’m trying to install ROS.jl. After adding the package using pkg\> add ROS and calling using ROS, I get the following error: julia\> using ROS \[ Info: Precompiling ROS \[a492bfac-16cc-4d50-a8b6-f03352b6b563\] \[ Info: S…

---

## [Creating a custom data type for CxxWrap](https://discourse.julialang.org/t/creating-a-custom-data-type-for-cxxwrap/69740)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 2\
**Last updated:** [October 15, 2021, 4:00am UTC](https://discourse.julialang.org/t/creating-a-custom-data-type-for-cxxwrap/69740 "2021-10-15T04:00:15Z")

</div>

I’m trying to write a wrapper for a C++ library using CxxWrap.jl. In C++, there are types like typedef struct { int MyType; int \*List; } MyRecord typedef MyRecord \*MyPointer; typedef MyPointer \*MyList; To create …

---

## [Calling C++ function having std::vectors as input and output parameters from Julia](https://discourse.julialang.org/t/calling-c-function-having-std-vectors-as-input-and-output-parameters-from-julia/9224)

<div class="topic-metadata">

**Author:** [@pdlotko](https://discourse.julialang.org/u/pdlotko)\
**Replies:** 12\
**Last updated:** [September 9, 2021, 12:20am UTC](https://discourse.julialang.org/t/calling-c-function-having-std-vectors-as-input-and-output-parameters-from-julia/9224 "2021-09-09T00:20:08Z")

</div>

Dear All I am new to Julia and and I am trying to access my C++ code from Julia. I have asked this question already at Stack Overflow, but were not able to find an answer there. I am trying to call a C++ function from …

---

## [CxxWrap-based wrapper throws error in running finalizer: ReadOnlyMemoryError()](https://discourse.julialang.org/t/cxxwrap-based-wrapper-throws-error-in-running-finalizer-readonlymemoryerror/67097)

<div class="topic-metadata">

**Author:** [@stemann](https://discourse.julialang.org/u/stemann)\
**Replies:** 1\
**Last updated:** [August 29, 2021, 8:58am UTC](https://discourse.julialang.org/t/cxxwrap-based-wrapper-throws-error-in-running-finalizer-readonlymemoryerror/67097 "2021-08-29T08:58:49Z")

</div>

Hi I am updating a CxxWrap-based wrapper for a C++ library from Julia 1.0 and CxxWrap 0.8.1 - with succesful unit tests - and a dev container - to Julia 1.6 (1.3+) and the latest released CxxWrap, 0.11.2: https://github…

---

## [Using a C++ library with Julia 1.\*.\*](https://discourse.julialang.org/t/using-a-c-library-with-julia-1/17573)

<div class="topic-metadata">

**Author:** [@Luis\_de\_Sousa](https://discourse.julialang.org/u/Luis_de_Sousa)\
**Replies:** 32\
**Last updated:** [August 9, 2021, 10:26pm UTC](https://discourse.julialang.org/t/using-a-c-library-with-julia-1/17573 "2021-08-09T22:26:05Z")

</div>

In the index page of julialang.org is stated: you can easily use libraries from Python, R, C/Fortran, C++, and Java The C++ bit links to a library called Cxx that fails to install on Julia 1.0.0 and 1.0.2 and seems t…

---

## [Use CMake generate a shared library .so which is to be used in Julia](https://discourse.julialang.org/t/use-cmake-generate-a-shared-library-so-which-is-to-be-used-in-julia/32197)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [December 12, 2019, 1:51pm UTC](https://discourse.julialang.org/t/use-cmake-generate-a-shared-library-so-which-is-to-be-used-in-julia/32197 "2019-12-12T13:51:40Z")

</div>

Following the example 3 this link, Introduction to CMake by Example | derekmolloy.ie, I successfully generate a shared library with name listestStudent.so. Then, following the example 8 of this link: GitHub - JuliaInte…

---

## [Help wanted to create Julia binding for the MGIS project using CxxWrap and testing](https://discourse.julialang.org/t/help-wanted-to-create-julia-binding-for-the-mgis-project-using-cxxwrap-and-testing/24244)

<div class="topic-metadata">

**Author:** [@thelfer](https://discourse.julialang.org/u/thelfer)\
**Replies:** 0\
**Last updated:** [May 15, 2019, 4:09pm UTC](https://discourse.julialang.org/t/help-wanted-to-create-julia-binding-for-the-mgis-project-using-cxxwrap-and-testing/24244 "2019-05-15T16:09:14Z")

</div>

Hi, I hope that this request is not off-topic. I am the main developper of a project called MGIS (https://github.com/thelfer/MFrontGenericInterfaceSupport) which aims at providing tools to interact with the mechanical …

---

## [Using Cxx malloc error: pointer being freed was not allocated](https://discourse.julialang.org/t/using-cxx-malloc-error-pointer-being-freed-was-not-allocated/12198)

<div class="topic-metadata">

**Author:** [@Avary\_Kolasinski](https://discourse.julialang.org/u/Avary_Kolasinski)\
**Replies:** 0\
**Last updated:** [July 5, 2018, 10:40pm UTC](https://discourse.julialang.org/t/using-cxx-malloc-error-pointer-being-freed-was-not-allocated/12198 "2018-07-05T22:40:15Z")

</div>

Hello, I am calling a C++ function in my Julia function using Cxx. Within the C++ function I use: buffer = malloc(size) … free(buffer); so the buffer is not passing into the Julia function however, when running the …

---

## [Cxx and complex values](https://discourse.julialang.org/t/cxx-and-complex-values/28129)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 0\
**Last updated:** [August 28, 2019, 5:44pm UTC](https://discourse.julialang.org/t/cxx-and-complex-values/28129 "2019-08-28T17:44:04Z")

</div>

Is there currently machinery in Cxx.jl to convert between Julia’s Complex type and c++'s std::complex? If not, is there a common workaround?

---

## [Embedding C++ code inside a Julia function using Cxx package](https://discourse.julialang.org/t/embedding-c-code-inside-a-julia-function-using-cxx-package/30659)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [November 3, 2019, 4:50pm UTC](https://discourse.julialang.org/t/embedding-c-code-inside-a-julia-function-using-cxx-package/30659 "2019-11-03T16:50:45Z")

</div>

Hey, I was playing with the Cxx package and tried the following code and got confused. :wink: julia\> function playing() for i=1:5 icxx""" int tellme; std:…

---

## [How to make CxxWrap bindings to a std::vector\<std::tuple...?](https://discourse.julialang.org/t/how-to-make-cxxwrap-bindings-to-a-std-vector-std-tuple/37976)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 0\
**Last updated:** [April 21, 2020, 5:24pm UTC](https://discourse.julialang.org/t/how-to-make-cxxwrap-bindings-to-a-std-vector-std-tuple/37976 "2020-04-21T17:24:59Z")

</div>

I’m continuing on my CxxWrap.jl journey… I would like to wrap a function that returns the complex type: std::vector\<std::tuple\<int, int\> \>. A function that returns simply a tuple or a vector works fine. I can also get …

---

## [Compiling CUDA code with Cxx.jl](https://discourse.julialang.org/t/compiling-cuda-code-with-cxx-jl/28382)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 0\
**Last updated:** [September 4, 2019, 5:57pm UTC](https://discourse.julialang.org/t/compiling-cuda-code-with-cxx-jl/28382 "2019-09-04T17:57:45Z")

</div>

Hi, I was wondering whether there is an example where they compile a CUDA code with Cxx.jl with specific compiler flags. So my question is actually two fold: how to pass specific compiler flags? how to compile cuda c…

---

## [Help needed for packaging a C++ wrapper with CxxWrap](https://discourse.julialang.org/t/help-needed-for-packaging-a-c-wrapper-with-cxxwrap/41591)

<div class="topic-metadata">

**Author:** [@cstich](https://discourse.julialang.org/u/cstich)\
**Replies:** 0\
**Last updated:** [June 17, 2020, 1:01pm UTC](https://discourse.julialang.org/t/help-needed-for-packaging-a-c-wrapper-with-cxxwrap/41591 "2020-06-17T13:01:37Z")

</div>

I have written a Julia wrapper for a C++ library using CxxWrapper . I don’t have much experience with C++ but I managed to compile everything with cmake into a shared library and I can call the function I want from withi…

---

## [How to use @code\_native with Cxx.jl](https://discourse.julialang.org/t/how-to-use-code-native-with-cxx-jl/34556)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 0\
**Last updated:** [February 13, 2020, 5:26am UTC](https://discourse.julialang.org/t/how-to-use-code-native-with-cxx-jl/34556 "2020-02-13T05:26:18Z")

</div>

Hi, If I do something like using Cxx cxx""" double f(double x) { return 2.0\*pow(x,4)-3.0\*pow(x,3)+2.0\*pow(x,2)-x; } """ jf(x) = @cxx f(x) and then do @code\_native jf(2.0) the code appears to be the code that call…

---

## [Segfault with CxxWrap on Raspberry Pi](https://discourse.julialang.org/t/segfault-with-cxxwrap-on-raspberry-pi/37498)

<div class="topic-metadata">

**Author:** [@Ilay101](https://discourse.julialang.org/u/Ilay101)\
**Replies:** 0\
**Last updated:** [April 13, 2020, 10:40am UTC](https://discourse.julialang.org/t/segfault-with-cxxwrap-on-raspberry-pi/37498 "2020-04-13T10:40:42Z")

</div>

Hi, I experiencing a segfault when trying to use the hello demo with CxxWrap. I am using julia 1.4 and CxxWrap 0.10.0 (and libcxxwrap\_julia\_jll 0.7 installed by CxxWrap) on a Raspberry Pi (armv7l) with raspbian buster …

---

## [Call C++ dll used Cxx.jl on windows](https://discourse.julialang.org/t/call-c-dll-used-cxx-jl-on-windows/60766)

<div class="topic-metadata">

**Author:** [@wgst1024](https://discourse.julialang.org/u/wgst1024)\
**Replies:** 0\
**Last updated:** [May 8, 2021, 8:46am UTC](https://discourse.julialang.org/t/call-c-dll-used-cxx-jl-on-windows/60766 "2021-05-08T08:46:41Z")

</div>

Refer to official documents Example 8: Using C++ with shared libraries，the example is on linux，but I want to test on windows. https://github.com/JuliaInterop/Cxx.jl JuliaDll.h #ifndef ARRAYMAKER\_H #define ARRAYMAKER…

---

## [Reviving concrete package depending on Cxx.jl](https://discourse.julialang.org/t/reviving-concrete-package-depending-on-cxx-jl/51734)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 0\
**Last updated:** [December 12, 2020, 6:34pm UTC](https://discourse.julialang.org/t/reviving-concrete-package-depending-on-cxx-jl/51734 "2020-12-12T18:34:48Z")

</div>

Case and point. Last Friday, 11 December, there was a meeting of Julia users from Discours working in high energy physics (topic for another discusion). At the top of priorities emerges reviving of ROOT.jl package, which…

---

## [Problem with unsafe\_wrap() and Cxx.jl](https://discourse.julialang.org/t/problem-with-unsafe-wrap-and-cxx-jl/39228)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 0\
**Last updated:** [May 10, 2020, 1:54pm UTC](https://discourse.julialang.org/t/problem-with-unsafe-wrap-and-cxx-jl/39228 "2020-05-10T13:54:14Z")

</div>

As the title suggests, I’ve run into very puzzling behavior with Cxx and unsafe\_wrap(). I’ve got some c++ code that returns vector\<vector\<uint8\_t\>\>& which I’m viewing in Julia. I can perform the same operation twice in a…

---

## [Where can I follow compiler work progress?](https://discourse.julialang.org/t/where-can-i-follow-compiler-work-progress/65503)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 21\
**Last updated:** [August 4, 2021, 1:54pm UTC](https://discourse.julialang.org/t/where-can-i-follow-compiler-work-progress/65503 "2021-08-04T13:54:36Z")

</div>

Hi, I would like to follow the progress done on Julia with regards to slow compilation time. I found the following list of work: Is there a web page where I can see the milestones being completed or how each steps in…

[Next page](https://discourse.julialang.org/tag/cxx/86.md?match_all_tags=true&page=1&tags%5B%5D=cxx)
