Ccall library as a variable string

This works right,
ccall((:lwrite, “/home/mikel/mylibraries/libCbin_IO”), void, ())

But if I define a variable to specify the library, it does not work.
mylib=/home/mikel/mylibraries/libCbin_IO"
ccall((:lwrite,mylib), void, ())

Can someone help me?

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:

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

See also PSA: how to quote code with backticks

1 Like

Using

I have solve the problem using variable const:
const mylib = "/home/mikel/mylibraries/libCbin_IO"
ccall((:lwrite,mylib), Cvoid, ())

Thank you.