I propose the following additions to the codebase:
MVMDLLibRegistry
Wraps dyncall's DLLib*
together with a string id in a per-instance hash.
Keeps track of a refcount to prevent the user from prematurely freeing a library.
DLSym
Wraps the pointer returned by dlFindSymbol()
together with a MVMDLLibRegistry*
.
Conjecture: This will be the argument to the (yet to be implemented) and could be used as input to my loadextop
(or whatever we end up calling it)ptrcast
op from the ctypes
branch. (adding exptops by symbol is probably not a good idea)
loadlib(str id, str path)
freelib(str id)
findsym(str id, str name) -> obj sym
dropsym(obj sym)
dropsym
sets a symbol to NULL
, decreasing the refcount of the containing library.
Open question: How should loadlib
handle libraries that (according to their id) have already been loaded? Silently ignore, throw or via return value?