# How to distribute a wrapper for a C++ library?

**URL:** <https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581>\
**Category:** Package Management\
**Tags:** artifacts, cxxwrap\
**Created:** [July 9, 2025, 4:07pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581 "2025-07-09T16:07:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [July 9, 2025, 4:07pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/1 "2025-07-09T16:07:03Z")

</div>

Could anyone share experience on how to distribute a C++ wrapper through package manager?

My workflow idea is the following:

- package is available from a third-party registry
- wrapped library and C++ shim are packaged in binary form and available from the same registry

Given that the shim depends on the wrapped library and the Julia module needs to load the shim first to work, what would be the recommended way to specify the paths to the corresponding artifacts?

---

<div class="post-metadata">

**Author:** ![palday](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palday/32/12640_2.png) [@palday](https://discourse.julialang.org/u/palday)\
**Post date:** [July 9, 2025, 4:16pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/2 "2025-07-09T16:16:36Z")

</div>

I think you want to create a JLL package – [GitHub - JuliaPackaging/Yggdrasil: Collection of builder repositories for BinaryBuilder.jl](https://github.com/JuliaPackaging/Yggdrasil) is probably the way to go.

---

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [July 9, 2025, 7:26pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/3 "2025-07-09T19:26:02Z")

</div>

Yes, I think so too but so far I don’t have experience with that.  
Say, I’ve managed to build a JLL for a binary library.  
Now, how should I get the path to the .so file associated with it? Would it be exported in JLL or maybe it’s going to be a fixed path relative to `JULIA_DEPOT_PATH`?

---

<div class="post-metadata">

**Author:** ![jbytecode](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbytecode/32/17719_2.png) [@jbytecode](https://discourse.julialang.org/u/jbytecode)\
**Post date:** [July 9, 2025, 7:32pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/4 "2025-07-09T19:32:34Z")

</div>

It’s a good practice to follow hello world samples,

for C:

> **[Yggdrasil/H/HelloWorldC at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldC)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

C++:

> **[Yggdrasil/H/HelloWorldCxx at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldCxx)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

FORTRAN:

> **[Yggdrasil/H/HelloWorldFortran at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldFortran)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

GO:

> **[Yggdrasil/H/HelloWorldGo at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldGo)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

OCaml:

> **[Yggdrasil/H/HelloWorldOCaml at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldOCaml)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

Rust:

> **[Yggdrasil/H/HelloWorldRust at master · JuliaPackaging/Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil/tree/master/H/HelloWorldRust)**
>
> Collection of builder repositories for BinaryBuilder.jl - JuliaPackaging/Yggdrasil

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [July 9, 2025, 8:22pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/5 "2025-07-09T20:22:56Z")

</div>

> [@Vasily\_Pisarev](#):
>
> Now, how should I get the path to the .so file associated with it? Would it be exported in JLL

Let’s have a look at a JLL package.

```julia
julia> using OpenSlide_jll

julia> names(OpenSlide_jll)
2-element Vector{Symbol}:
 :OpenSlide_jll
 :libopenslide

julia> OpenSlide_jll.libopenslide
"/home/gunnar/.julia/artifacts/e6604bff9ad493834da0c27adf8174616d54864e/lib/libopenslide.so"

```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 9, 2025, 9:21pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/6 "2025-07-09T21:21:54Z")

</div>

> [@Vasily\_Pisarev](#):
>
> Now, how should I get the path to the .so file associated with it?

> **[JLL packages · BinaryBuilder.jl](https://docs.binarybuilder.org/stable/jll/#LibraryProduct)**
>
> Documentation for BinaryBuilder.jl.

---

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [July 10, 2025, 8:57pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/7 "2025-07-10T20:57:43Z")

</div>

Thank you all for the directions!  
Now I have to dig deeper into the BinaryBuilder and JLLs.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 10, 2025, 9:13pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/8 "2025-07-10T21:13:03Z")

</div>

For example, QML.jl uses CxxWrap.jl to provide C-callable wrappers for an external C++ library (Qt). It seems to compile the wrapper and the C++ library into a single library: [GitHub - JuliaGraphics/jlqml: C++ component of the QML.jl package](https://github.com/JuliaGraphics/jlqml), which packages a library in Julia as `jlqml_jll` using [this Yggdrasil build script](https://github.com/JuliaPackaging/Yggdrasil/blob/085fea7e59aceb28f5f6c64ad981b5ac38966ed5/J/jlqml/build_tarballs.jl).

---

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [July 11, 2025, 1:22pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/9 "2025-07-11T13:22:32Z")

</div>

I was thinking too if it would be logical to package both wrapper and the original library into a single JLL. Thanks for pointing to a way how it may be done!

---

<div class="post-metadata">

**Author:** ![ceesb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ceesb/32/219871_2.png) [@ceesb](https://discourse.julialang.org/u/ceesb)\
**Post date:** [December 10, 2025, 8:42pm UTC](https://discourse.julialang.org/t/how-to-distribute-a-wrapper-for-a-c-library/130581/10 "2025-12-10T20:42:44Z")

</div>

I think my problem is related to the original question, but not exactly the same. I cannot figure out how I would be _packaging_ (i.e. publishing on the registry) a CxxWrap based project that needs a Visual studio build of libcxxwrap-julia. When CxxWrap is installed on Windows, it pulls in a Mingw build of libcxxwrap-julia, which is not compatible with the glue that I need, since I am wrapping a Visual Studio built library (this is a given). What magic do I need in my project to make CxxWrap not load the Mingw version, or am I asking the wrong question.
