@threadcall and dlsym in Julia 1.3

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.

/* foo.c */
#include <stdio.h>
void myfunction(int x) {
    printf("x is %d\n", x);
clang -shared -undefined dynamic_lookup -o libfoo.so foo.c
# 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?

This does work:

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

(pattern matching 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.