# InitError: could not load library "...libcxxwrap\_julia\_stl.dll" on windows

**URL:** <https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535>\
**Category:** General Usage\
**Tags:** cxxwrap\
**Created:** [January 13, 2022, 8:18am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535 "2022-01-13T08:18:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiemstar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiemstar/32/32737_2.png) [@hiemstar](https://discourse.julialang.org/u/hiemstar)\
**Post date:** [January 13, 2022, 8:18am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/1 "2022-01-13T08:18:39Z")

</div>

I successfully build `libcxxwrap_julia` from source on Windows using

```
cmake -DJulia_EXECUTABLE="home/AppData/Local/Programs/Julia-1.6.3/bin/julia" .. -G "Visual Studio 16"
cmake --build . --config=Release

```

and have added an `Overrides.toml` file in the `.julia/arctifacts` folder

```
[3eaa8342-bff7-56a5-9981-c04077f7cee7]
libcxxwrap_julia = "C:/Users/rrhie/Documents/cpp-test/libcxxwrap-julia/build"

```

When I open julia in the `REPL`, add and use `CxxWrap` I get the following error

```
julia> using CxxWrap
ERROR: InitError: could not load library 
"C:\Users\rrhie\.julia\artifacts\41b86dcf7a6b239850cbbc378d7eaa5a87d7e4f3\bin\libcxxwrap_julia_stl.dll"
The specified procedure could not be found.
Stacktrace: ...

```

It seems like `CxxWrap` is not using my locally compiled version of `libcxxwrap_julia`.

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![hiemstar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiemstar/32/32737_2.png) [@hiemstar](https://discourse.julialang.org/u/hiemstar)\
**Post date:** [January 13, 2022, 8:50am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/2 "2022-01-13T08:50:32Z")

</div>

I just got it working. Apparently the Overrides.toml file was not correct, although I followed the instructions on [libcxxwrap-julia](https://github.com/JuliaInterop/libcxxwrap-julia)

The contents of Overrides.toml that work are:

```
41b86dcf7a6b239850cbbc378d7eaa5a87d7e4f3 = "C:/Users/rrhie/Documents/cpp-test/libcxxwrap-julia/build"

```

So I used the content hash directly.

I will open an issue on [libcxxwrap-julia](https://github.com/JuliaInterop/libcxxwrap-julia)  
to adapt the installation instructions in their README.

---

<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:** [January 21, 2022, 2:28pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/3 "2022-01-21T14:28:44Z")

</div>

Hi @hiemstar , Thank you for the above it is helpful. I had the same error message that you have.  
Changing the contents of Overrides.toml seemed to make it work however I got another error message after installing `CxxWrap`:

```julia
(@v1.7) pkg> add CxxWrap
Updating registry at `C\Users\gitboy\.julia\registries\General.toml`
Resolving package versions...
Downloaded artifact: libcxxwrap_julia
Downloaded artifact: libcxxwrap_julia
Updating `C\Users\gitboy\.julia\environments\1.7\Project.toml`
[1f15a43c] + CxxWrap v0.12.0
Updating `C\Users\gitboy\.julia\environments\1.7\Manifest.toml`
[1f15a43c] + CxxWrap v0.12.0
[1914dd2f] + MacroTools v0.5.9
[3eaa8342] +libcxxwrap_julia_jll v0.9.0+0
Info packages marked with not downloaded, use `instantiate` to download
Downloaded artifact: libcxxwrap_julia
Downloaded artifact: libcxxwrap_julia

julia> using CxxWrap
ERROR: InitError: Artifact "libccxwrap_julia" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources.
Stacktrace:
[1] error(s::String)
@Base .\error.jl:33
[2] _artifact_str ...etc

julia> using Pkg; Pkg.instantiate()
Downloaded artifact: libcxxwrap_julia
Downloaded artifact: libcxxwrap_julia

julia> using CxxWrap
Error: InitError: could not load library ""
The parameter ia incorrect.
Stacktrace:
[1] libcxxwrapversion()
@ CxxWrap.CxxWrapCore C:\Users\gitboy\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:33
during initialization of module CxxWrapCore

julia>

```

Any idea how I can solve this? Thank you  
Fyi similar issue here: [Ccall c++ sort vector of String - #33 by barche](https://discourse.julialang.org/t/ccall-c-sort-vector-of-string/74635/33)

---

<div class="post-metadata">

**Author:** ![hiemstar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiemstar/32/32737_2.png) [@hiemstar](https://discourse.julialang.org/u/hiemstar)\
**Post date:** [January 22, 2022, 1:50pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/4 "2022-01-22T13:50:31Z")

</div>

Are you building libcxxwrap-julia from source? On windows you cannot use the one provided by CxxWrap.

---

<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:** [January 23, 2022, 8:29am UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/5 "2022-01-23T08:29:43Z")

</div>

Yes I am building it from sources.  
Would you be able to give the exact list of windows command you run from the very beginning (including the git clone …etc) because I had to change your first command from:

```julia
cmake -DJulia_EXECUTABLE="home/AppData/Local/Programs/Julia-1.6.3/bin/julia" .. -G "Visual Studio 16"

```

To

```julia
cmake -G "Visual Studio 16" -DJulia_EXECUTABLE="D:/Julia-1.7.1/bin/julia" . 

```

In order to make it work.  
I also had to change the hash in the toml file because mine is different. Thank you

---

<div class="post-metadata">

**Author:** ![hiemstar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiemstar/32/32737_2.png) [@hiemstar](https://discourse.julialang.org/u/hiemstar)\
**Post date:** [January 26, 2022, 12:38pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/6 "2022-01-26T12:38:49Z")

</div>

Here are all the steps:

```julia
git clone https://github.com/JuliaInterop/libcxxwrap-julia.git
cd .\libcxxwrap-julia\
mkdir build
cd .\build\
cmake -DJulia_EXECUTABLE="C:\Users\rrhie\AppData\Local\Programs\Julia-1.6.3\bin\julia" .. -G "Visual Studio 16"
 cmake --build . --config=Release
 ctest . -C Release

```

The last line tests if the library is build correctly and if CxxWrap can find libcxxwrap-julia

```julia
Test project C:/Users/rrhie/Documents/julia-projects/libcxxwrap-julia/build
    Start 1: test_module
1/3 Test #1: test_module ...................... Passed 1.32 sec
    Start 2: test_type_init
2/3 Test #2: test_type_init ................... Passed 1.31 sec
    Start 3: test_cxxwrap
3/3 Test #3: test_cxxwrap ..................... Passed 39.59 sec

100% tests passed, 0 tests failed out of 3

```

---

<div class="post-metadata">

**Author:** ![hiemstar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiemstar/32/32737_2.png) [@hiemstar](https://discourse.julialang.org/u/hiemstar)\
**Post date:** [January 26, 2022, 12:44pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/7 "2022-01-26T12:44:05Z")

</div>

Btw, make sure Julia doesn’t use some old cached version of `CxxWrap`. In that case `CxxWrap` may use the wrong path to `libcxxwrap-julia`. This can be done by removing `.julia\packages\CxxWrap`.

Subsequently do a clean install of `CxxWrap.jl` using `Pkg.add(CxxWrap)`

---

<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:** [January 26, 2022, 3:07pm UTC](https://discourse.julialang.org/t/initerror-could-not-load-library-libcxxwrap-julia-stl-dll-on-windows/74535/8 "2022-01-26T15:07:30Z")

</div>

Yes that is the issue I had, it was using a old cached veraion of CxxWrap. Thank you for the help.
