A dynamic shared object loaded with the support of the operative system,
also known as .so libraries or as DLL.
Insert DYNAMIC_LINKING_LOADER and use new_dynamic_shared_object or
main_program to get an instance of this class.
Currently available only on POSIX systems where it wraps dlopen
Build a FAST_ARRAY of STRINGs from a_pointer which must be of a
NULL-terminated array of C strings, that is a "char**" String
contents and array itself are copied.
If this value is specified, or the environment variable LD_BIND_NOW is set to a non-empty string, all undeined symbols in the library are resolved before dlopen() returns.
Optional flags: zero of more of the following values may also be ORed
The address where a_symbol - belonging to Current - is loaded into
memory.
If it is not found, either in Current or in its dependecies
Result will be default_pointer. The search performed is breadth
first through the dependency tree of these libraries. Since the
value of the symbol could actually be default_pointer (defined as
NULL in C) the correct way to test for an error is to assign
error to a local string, invoke symbol and assign error again
checking for the last value.
foo (a_dll: DYNAMIC_SHARED_OBJECT) is
require a_dll/=Void
local precall_status, post_status: STRING; my_symbol: POINTER
do
precall_status := a_dll.error
my_symbol := a_dll.symbol("foo")
post_status := a_dll.error
if post_status/=Void then -- everything ok
else -- error resolving "foo"
end
Do not write "if a_dll.symbol("foo").is_not_null", defaull_pointer may be the actual value of "foo"
Do not write "my_symbol:=a_dll.symbol("foo") if a_dll.error/=Void
then print(a_dll.error)", because error is resetted every time it
invoked; the print command will ALWAYS fails because its argument
will be NULL.
There are two special pseudo-handles, "RTLD_DEFAULT" and
"RTLD_NEXT". The former will find the first occurrence of the
desired symbol using the default library search order. The latter
will find the next occurrence of a function in the search order
after the current library. This allows one to provide a wrapper
around a function in another shared library.
This exception occurs when Void is passed as the expression
to inspect ("inspect on STRING only).
This exception also occurs when the inspected value selects no branch (when the keyword "else"
not used, one "when" branch _must_ be selected). Some value which is not one of the inspect
constants, if there is no Else_part
r
Build a FAST_ARRAY of STRINGs from a_pointer which must be of a
NULL-terminated array of C strings, that is a "char**" String
contents and array itself are copied.
Only resolve symbols as the code that references them is executed. If the symbol is never referenced, then it is never resolved. (Lazy binding is only performed for function references; references to variables are always immediately bound when the library is loaded.)
If this value is specified, or the environment variable LD_BIND_NOW is set to a non-empty string, all undeined symbols in the library are resolved before dlopen() returns.
(since glibc 2.2) Do not unload the library during dlclose().
Consequently, the library's static variables are not reiniā tialized if the library is reloaded with dlopen() at a later time. This flag is not specified in POSIX.1-2001.
This can be used to test if the library is already resident (dlopen() returns NULL if it is not, or the library's handle if it is resident). This flag can also be used to promote the flags on a library that is already loaded. For example, a library that was previously loaded with RTLD_LOCAL can be re-opened with RTLD_NOLOAD | RTLD_GLOBAL. This flag is not specified in POSIX.1-2001.
(since glibc 2.3.4) Place the lookup scope of the symbols in this library ahead of the global scope.
This means that a self- contained library will use its own symbols in preference to global symbols with the same name contained in libraries that have already been loaded. This flag is not specified in POSIX.1-2001.