The erl_ddll
module can load and link a linked-in
driver, if run-time loading and linking of shared objects, or
dynamic libraries, is supported by the underlying operating
system.
load_driver(Path, Name) -> ok | {error, ErrorDesc}
Types:
Path = Name = string() | atom()
ErrorDesc = term()
Loads and links the dynamic driver Name
. Path
is a file path to the directory containing the driver.
Name
must be a sharable object/dynamic library. Two
drivers with different Path
s cannot be loaded under
the same name. The number of dynamically loadable drivers is
limited by the size of driver_tab
in driver_tab.c
.
unload_driver(Name) -> ok | {error, ErrorDesc}
Types:
Name = string() | atom()
Reason = term()
Unloads the dynamic driver Name
. This will fail if
any port programs are running the code that is being unloaded.
Linked-in drivers cannot be unloaded. The process must
previously have called load_driver/1
for the driver.
There is no guarantee that the memory where the driver was loaded is freed. This depends on the underlying operating system.
loaded_drivers() -> {ok, Drivers}
Types:
Drivers = [Driver()]
Driver = string()
Returns a list of all the available drivers, both (statically) linked-in and dynamically loaded ones.
format_error(ErrorDesc) -> string()
Types:
ErrorDesc -- see below
Takes an ErrorDesc
returned by load_driver/2
or unload_driver/1
and returns a string which
describes the error or warning.
erl_driver(4), driver_entry(4)