# Passing environmental variables to library?

**URL:** https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079
**Category:** General Usage
**Tags:** question
**Created:** [August 26, 2018, 11:06am UTC](https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079 "2018-08-26T11:06:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)
#### Post date: [August 26, 2018, 11:06am UTC](https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079/1 "2018-08-26T11:06:36Z")

</div>

I’m calling a C library FastTransforms ([GitHub - MikaelSlevinsky/FastTransforms: Fast orthogonal polynomial transforms](https://github.com/MikaelSlevinsky/FastTransforms)) whose threads are controlled by two environmental variables:

```julia
export OMP_NUM_THREADS=4
export VECLIB_MAXIMUM_THREADS=4

```

If I call an executable from the command line, the library sees the settings and correctly launches 4 threads. If I call the library from within Julia via `ccall`, it is only launching 1 thread.

Any ideas how to correctly “pass through” the environmental variables?

---

<div class="post-metadata">

### Author: ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)
#### Post date: [August 26, 2018, 1:02pm UTC](https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079/2 "2018-08-26T13:02:08Z")

</div>

One idea is to try the Base.ENV which seems to be an interface to environment variables of the current process. If this feeds through via dlopen to the library is tbt.
