# Ccall() and libc on Linux

**URL:** <https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402>\
**Category:** General Usage\
**Created:** [November 22, 2019, 9:16pm UTC](https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402 "2019-11-22T21:16:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleisher](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mleisher](https://discourse.julialang.org/u/mleisher)\
**Post date:** [November 22, 2019, 9:16pm UTC](https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402/1 "2019-11-22T21:16:42Z")

</div>

Trying to use ccall() to call a function from libc and julia only finds the GNU ld script in /usr/lib64/libc.so, not the actual library which is located in /lib64/libc.so.6.

Can julia be told to parse the GNU ld script or is there a way I can explicitly tell ccall() to use /lib64/libc.so.6?

I’m hoping I simply missed the relevant bits of documentation and someone can point me at them.

---

<div class="post-metadata">

**Author:** ![mleisher](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mleisher](https://discourse.julialang.org/u/mleisher)\
**Post date:** [November 22, 2019, 9:27pm UTC](https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402/2 "2019-11-22T21:27:08Z")

</div>

I just figured out I can open the library from an explicit location using Libdl. Suboptimal, but works in the short-term.

It would be nice to have Libdl eventually become capable of parsing GNU ld scripts for locations of the binary libraries. A project for another time, perhaps.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 22, 2019, 10:25pm UTC](https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402/3 "2019-11-22T22:25:34Z")

</div>

Julia is already linked to libc, so you shouldn’t need to specify the library to `ccall` at all.

---

<div class="post-metadata">

**Author:** ![mleisher](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mleisher](https://discourse.julialang.org/u/mleisher)\
**Post date:** [November 22, 2019, 10:28pm UTC](https://discourse.julialang.org/t/ccall-and-libc-on-linux/31402/4 "2019-11-22T22:28:09Z")

</div>

Doh! That works fine! Thanks!
