You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, you can only access global variables by a combination of dlsym and dlopen: convert(Ptr{T}, dlsym(dlopen("libname"), "varname")). Not only is this ugly, but it will also make things difficult for future static compilation (where we would like to directly link any needed shared libraries with ld, rather than requiring them to be dlopened at runtime).
I'd like to suggest a cglobal(symbol, T=Void) intrinsic, returning a Ptr{T}, that mirrors ccall(symbol, ...). That is, the symbol argument could be a symbol, a (symbol,library) pair, or a pointer returned by dlsym (although in that case cglobal wouldn't do much, just a typecast).
Currently, you can only access global variables by a combination of
dlsym
anddlopen
:convert(Ptr{T}, dlsym(dlopen("libname"), "varname"))
. Not only is this ugly, but it will also make things difficult for future static compilation (where we would like to directly link any needed shared libraries withld
, rather than requiring them to be dlopened at runtime).I'd like to suggest a
cglobal(symbol, T=Void)
intrinsic, returning aPtr{T}
, that mirrorsccall(symbol, ...)
. That is, thesymbol
argument could be a symbol, a(symbol,library)
pair, or a pointer returned bydlsym
(although in that case cglobal wouldn't do much, just a typecast).(See #961 for some pre-history of this problem.)
The text was updated successfully, but these errors were encountered: