# JLL library: how to use boost\_jll

**URL:** <https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 5, 2021, 3:08pm UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895 "2021-08-05T15:08:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [August 5, 2021, 3:08pm UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895/1 "2021-08-05T15:08:30Z")

</div>

Hi,  
Is there a simple example on how to use the boost\_jll library?

1/ I would like for example to use `boost::sort::block_indirect_sort` in `#include <boost/sort/sort.hpp>`. There is a C++ example here:

> **[C++ boost::sort::block\_indirect\_sort | C++ | cppsecrets.com](https://cppsecrets.com/users/1442971101051149897110100971154850485464103109971051084699111109/C00-boostsortblockindirectsort.php)**
>
> C++ and Python Professional Handbooks : A platform for C++ and Python Engineers, where they can contribute their C++ and Python experience along with tips and tricks. Reward Category : Most Viewed Article and Most Liked Article

2/ I also tried to use `file_size` from `boost::filesystem` like that

```julia
using boost_jll
ccall((:file_size, libboost_filesystem), Cint, (Cstring,), "D:/bo.txt")
ERROR: could not find symbol "file_size"

```

Would anyone be able to provide help on how to make these example work?  
I know these can easily be done in pure Julia but I just want to understand how to use these jll package.

Thank you

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [August 6, 2021, 6:35am UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895/2 "2021-08-06T06:35:55Z")

</div>

Boost is a C++, not a C library. The C++ compiler generates different symbols than a C compiler would.

The [JuliaCon2020 video about `CxxWrap.jl`](https://www.youtube.com/watch?v=u7IaXwKSUU0) explains the issue.

---

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [August 6, 2021, 6:59am UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895/3 "2021-08-06T06:59:04Z")

</div>

Yes I know it is C++ and tried CxxWrap as well (on windows with Julia 1.7) and it does not work either.

> [@CxxWrap on windows](https://discourse.julialang.org/t/cxxwrap-on-windows/65178):
>
> 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/ does anyone have a step by step tutorial for windows? The documentation seem a bit light for beginners. Thank you

Julia C++ support does not seem to be mature yet. I guess I will have to stick with Python/R for now.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [August 6, 2021, 8:31pm UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895/4 "2021-08-06T20:31:58Z")

</div>

I thought CxxWrap.jl just works?! And only good option now (other than calling indirectly to C++ through e.g. Python (there’s a thread on that), or using extern C in C++).

It’s of course not Julia’s responsibility to support C++, and I think you know that, nor clear you meant that.

I haven’t looked into what your issue is with CxxWrap.jl, it should work in 1.6.x. Julia 1.7 is of course not released yet (while very close), can you check if 1.6 works in case 1.7 breaks it (I don’t think it should, also unclear to me it could).

Cxx.jl used to work in supported Julia versions (you could try e.g. Julia 1.3 with it, it would just be informative). In that case Julia could and in a sense did break the package (strictly its updated LLVM dependency did it):

> [@Using a C++ library with Julia 1.\*.\*](https://discourse.julialang.org/t/using-a-c-library-with-julia-1/17573/32):
>
> Cxx.jl works with Julia 1.1 to 1.3, i.e. no supported version (I put in the warning in the package docs about that). I was rereading this thread, feeling a bit responsible, thinking I made a PR to the website, seems I didn’t, I’m recalling to Julia’s docs, actually it was for adding CppWrap.jl: [https://github.com/JuliaLang/julia/commit/07b7a7f95ac31bb1258083acd2fc95f36e800a85#diff-34369a758392e0eb32618c1c0fc711a35e114f00e87747b181e129156ec84035](https://github.com/JuliaLang/julia/commit/07b7a7f95ac31bb1258083acd2fc95f36e800a85#diff-34369a758392e0eb32618c1c0fc711a35e114f00e87747b181e129156ec84035) [Yes, I DID drop “Limited support” wording for …

I’m also intrigued about this new (to me) sorting algorithm in Boost, you might like to know of other interesting, seemingly to me best:

> [@Why does Base only have Merge Insertion and Quick sorting algorithms?](https://discourse.julialang.org/t/why-does-base-only-have-merge-insertion-and-quick-sorting-algorithms/65210/17):
>
> A. The fastest stable sort (published last month, based on his quadsort that’s “faster than quicksort”) seems to be: [https://github.com/scandum/blitsort](https://github.com/scandum/blitsort) Blitsort uses a [monobound binary search](https://github.com/scandum/binary_search), which is up to two times faster than the binary search in general use. Trinity rotation Blitsort uses a [trinity rotation](https://github.com/scandum/rotate), a new and significantly faster array rotation algorithm. […] By default blitsort uses 512 elements worth of stack memory. […] Blitsort rotate merges recursively, requiring an add…

---

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [December 12, 2021, 10:35am UTC](https://discourse.julialang.org/t/jll-library-how-to-use-boost-jll/65895/5 "2021-12-12T10:35:08Z")

</div>

How fast is that Blitsort vs Julia base sort? It is multi-threaded? It does not look so.  
On my old mac, I have the following under Julia 1.6.0:

```nohighlight
using BenchmarkTools
x = rand(100_000_000);
@btime sort(x);
11.311 s (2 allocations: 762.94 MiB)

```

I have written a sorting algo in C that I use in R/Python/Julia which give me the following:

```nohighlight
> x = runif(1e8)
> microbenchmark::microbenchmark(a = psort(x, nThread = 1L), times = 5L)
Unit: seconds
 expr min lq mean median uq max neval
    a 5.322546 5.385898 5.47175 5.480402 5.583312 5.58659 5
> microbenchmark::microbenchmark(a = psort(x, nThread = 2L), times = 5L)
Unit: seconds
 expr min lq mean median uq max neval
    a 2.973096 2.979794 3.017712 2.981372 3.014734 3.139564 5

```

I can also post the timings for `boost::sort::block_indirect_sort ` using Rcpp if needed.
