SML# - Language/FFI/DynamicLink Diff
Added parts are displayed
Deleted parts are displayed
Dynamically linked libraries (xxx.so file in Unix family, xxx.dll file
in Windows) can be loaded by the following SML# structure:
val dlclose : unit ptr -> unit
val dlopen : string -> unit ptr
val dlsym : unit ptr * string -> unit ptr
* '''dlopen(path)''' opens the given file path '''path''', and returns a handle pointer (of type unit ptr） to it. If open fails then the function raise SysErr exception.
* '''dlsym(ptr, s)''' searches the function having name '''s''' in the library pointed by the handle '''ptr''', and returns a pointer to the function.
* '''dlclose(ptr)''' closes the library file pointed by '''ptr'''.
Library name resolution is platform dependednt.
In a Unix family OS, SML# uses 'dlopen' and 'dlsym' library functions, which
consult the environment variable LD_LIBRARY_PATH for library path.
DynmicLink is one of [[FFI Libraries|Library/FFI]], which contain
several other useful utility modules.
SML# Document (in XHTML)
SML# 3.4.0 has been released
(Aug 31th, 2017).
Founded by The SML# Development Team.