# @threadcall and dlsym in Julia 1.3

**URL:** <https://discourse.julialang.org/t/threadcall-and-dlsym-in-julia-1-3/27778>\
**Category:** General Usage\
**Created:** [August 20, 2019, 11:24pm UTC](https://discourse.julialang.org/t/threadcall-and-dlsym-in-julia-1-3/27778 "2019-08-20T23:24:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rkat/32/3918_2.png) [@rkat](https://discourse.julialang.org/u/rkat)\
**Post date:** [August 20, 2019, 11:24pm UTC](https://discourse.julialang.org/t/threadcall-and-dlsym-in-julia-1-3/27778/1 "2019-08-20T23:24:24Z")

</div>

I have a dynamic library with a function in it that I’d like to call using `@threadcall` in Julia 1.3. This doesn’t seem to be possible. Here is a minimal example to reproduce the problem.

```nohighlight
/* foo.c */
#include <stdio.h>
void myfunction(int x) {
    printf("x is %d\n", x);
}

```

```bash
clang -shared -undefined dynamic_lookup -o libfoo.so foo.c

```

```julia
# foo.jl
using Libdl
lib = dlopen("libfoo.so")
myfunction = dlsym(lib, "myfunction")
ccall(myfunction, Cvoid, (Cint, ), 42) # prints "x is 42"
@threadcall(myfunction, Cvoid, (Cint, ), 42) # causes julia to exit

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [August 21, 2019, 12:34am UTC](https://discourse.julialang.org/t/threadcall-and-dlsym-in-julia-1-3/27778/2 "2019-08-21T00:34:13Z")

</div>

This does work:

```julia
@threadcall((:myfunction, "libfoo.so"), Cvoid, (Cint, ), 42)

```

(pattern matching [https://github.com/JuliaLang/julia/blob/71b63f33331ea1c4f49141735ac7b00fa8ce26a1/test/ccall.jl#L990](https://github.com/JuliaLang/julia/blob/71b63f33331ea1c4f49141735ac7b00fa8ce26a1/test/ccall.jl#L990)).

I don’t really know this stuff though; I’m sure someone will come by who does.
