# Libgl dlopen does not work in modules

**URL:** <https://discourse.julialang.org/t/libgl-dlopen-does-not-work-in-modules/13563>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 16, 2018, 12:04pm UTC](https://discourse.julialang.org/t/libgl-dlopen-does-not-work-in-modules/13563 "2018-08-16T12:04:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Post date:** [August 16, 2018, 12:04pm UTC](https://discourse.julialang.org/t/libgl-dlopen-does-not-work-in-modules/13563/1 "2018-08-16T12:04:19Z")

</div>

Hello, I am on julia 0.7 and I have the following problem.

This code runs without any problems:

```julia
using Libdl
dlopen(:libgslcblas, RTLD_GLOBAL)
sf_gamma_inc_Q(a, x) = ccall((:gsl_sf_gamma_inc_Q, :libgsl), Cdouble, (Cdouble, Cdouble), a, x)

sf_gamma_inc_Q(1.0, 2.0)

```

Now, when I put this into a Module and then try to use it, it does not work:

Gamma.jl:

```julia
module Gamma
using Libdl
dlopen(:libgslcblas, RTLD_GLOBAL)
sf_gamma_inc_Q(a, x) = ccall((:gsl_sf_gamma_inc_Q, :libgsl), Cdouble, (Cdouble, Cdouble), a, x)
end

```

somewhere else:

```julia
using Gamma
Gamma.sf_gamma_inc_Q(1.0, 2.0)

```

returns:

```julia
ERROR: LoadError: error compiling sf_gamma_inc_Q: could not load library "libgsl"
/usr/lib/libgsl.so: undefined symbol: cblas_ctrmv

```

When manually add `using Libdl; dlopen(:libgslcblas, RTLD_GLOBAL)` into this file everything works again.

But I want to work it without the need that `Gamma.jl` needs some additional libraries.

What is happening here and how can I fix it?

Thanks.
