# Ccall library as a variable string

**URL:** https://discourse.julialang.org/t/ccall-library-as-a-variable-string/25923
**Category:** General Usage
**Created:** [July 2, 2019, 11:47am UTC](https://discourse.julialang.org/t/ccall-library-as-a-variable-string/25923 "2019-07-02T11:47:23Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [July 2, 2019, 11:51am UTC](https://discourse.julialang.org/t/ccall-library-as-a-variable-string/25923/2 "2019-07-02T11:51:02Z")

</div>

> [@Mikel\_Antonana](#):
>
> But if I define a variable to specify the library, it does not work.

It is usually quite helpful to include the error message you get; “does not work” is not really much to go on.

I suspect all you need is to make your variable `const`:

```julia
const mylib = "/home/mikel/mylibraries/libCbin_IO"
ccall((:lwrite,mylib), Cvoid, ())

```

See also [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

---

_[View the full topic](https://discourse.julialang.org/t/ccall-library-as-a-variable-string/25923)._
