Skip to content

efficient interface for accessing an external c variable's value #1815

@vtjnash

Description

@vtjnash

proposed api (new built-in):
cvalue( (:sym, :lib), Type ) :: Type

functionally equivalent to
unsafe_ref( convert( Ptr{T}, dlsym( :sym, dlopen(:lib) ) ) )
but with only the unsafe_ref call occurring at runtime, the rest being converted into a llvm global at compile time (similar to the first argument to ccall)

additionally, another valuable function would be
cexists( (:sym, :lib) ) :: Bool

then I think dlsym/dlopen can be removed from the language?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions