# Is it possible for "ccall" to call the shared library created by PackageCompiler.jl?

**URL:** <https://discourse.julialang.org/t/is-it-possible-for-ccall-to-call-the-shared-library-created-by-packagecompiler-jl/84298>\
**Category:** General Usage\
**Tags:** ccall, package-compiler\
**Created:** [July 16, 2022, 3:14am UTC](https://discourse.julialang.org/t/is-it-possible-for-ccall-to-call-the-shared-library-created-by-packagecompiler-jl/84298 "2022-07-16T03:14:08Z")\
**Posts on this page:** 1\
**Showing post:** 39

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 21, 2022, 3:53pm UTC](https://discourse.julialang.org/t/is-it-possible-for-ccall-to-call-the-shared-library-created-by-packagecompiler-jl/84298/39 "2022-07-21T15:53:56Z")

</div>

> [@ohmsweetohm1](#):
>
> I have added the `include` dir to the `C/C++|General` `Additional Include Directories` and the the `bin` dir to `Linker|General` `Additional Library Directories`.
> 
> Sry, for the log being in German.

Make sure to follow all the steps

1. Set the `JULIA_DIR` environment variable. That should be the folder that contains `bin`, `include`, and `lib`.
2. The `bin` folder under JULIA\_DIR should be on the system PATH.
3. To modify the project, I used this main function and needed to add two additional preprocessor directives.

```cpp
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <julia.h>

int main()
{
    jl_init();
    jl_eval_string("print(sqrt(2.0))");
    jl_atexit_hook(0);
    return 0;
}

```

1. Set the project to Debug x64
2. Using the project Properties dialog, go to `C/C++` | `General` and add `$(JULIA_DIR)\include\julia\` to the Additional Include Directories property
3. Then, go to the `Linker` | `General` section and add `$(JULIA_DIR)\lib` to the Additional Library Directories property.
4. Finally, under `Linker` | `Input` , add `libjulia.dll.a;libopenlibm.dll.a;` to the list of libraries

I then get the following build log:

```julia
Build started...
1>------ Build started: Project: JuliaDemoEmbedding, Configuration: Debug x64 ------
1>JuliaDemoEmbedding.cpp
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\signal.h(26,1): warning C4005: 'NSIG': macro redefinition
1>~\.julia\juliaup\julia-1.7.3+0~x64\include\julia\uv\win.h(75): message : see previous definition of 'NSIG'
1>JuliaDemoEmbedding.vcxproj -> ~\source\repos\JuliaDemoEmbedding\x64\Debug\JuliaDemoEmbedding.exe
1>Done building project "JuliaDemoEmbedding.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

```

---

_[View the full topic](https://discourse.julialang.org/t/is-it-possible-for-ccall-to-call-the-shared-library-created-by-packagecompiler-jl/84298)._
