
Handle on a loaded shared library. (Specification)
Unload the library
Unload the library. Procedure pointers obtained from it become invalid. Closing an unloaded handle is a no-op.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(inout) | :: | self |
Handle on the library |
||
| type(state_type), | intent(out), | optional | :: | err |
Optional state return flag. On error, if not requested, the code stops |
Address of an exported variable
Address of an exported variable, to be used with c_f_pointer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(in) | :: | self |
Handle on a loaded library |
||
| character(len=*), | intent(in) | :: | name |
Name of the exported variable |
||
| type(state_type), | intent(out), | optional | :: | err |
Optional state return flag. On error, if not requested, the code stops |
Address of the variable, c_null_ptr on error
Path of the file that was actually loaded
Path of the file that was actually loaded ("" if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(in) | :: | self |
Handle on a library |
Path of the loaded file
Test whether a symbol is exported
.true. if the library is loaded and exports name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(in) | :: | self |
Handle on a library |
||
| character(len=*), | intent(in) | :: | name |
Name of the symbol to look for |
Whether the symbol is exported
Test whether a library is currently loaded
Whether a library is currently loaded into this handle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(in) | :: | self |
Handle on a library |
Whether a library is loaded
Load a shared library into this handle
Load a shared library into an existing handle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(inout) | :: | self |
Handle on the library. Must not be loaded already |
||
| character(len=*), | intent(in) | :: | name |
Library name, file name or path |
||
| character(len=*), | intent(in), | optional | :: | path |
Optional directory to search in, instead of the OS search rules |
|
| logical, | intent(in), | optional | :: | global |
Optional |
|
| type(state_type), | intent(out), | optional | :: | err |
Optional state return flag. On error, if not requested, the code stops |
Address of an exported procedure
Address of an exported procedure, to be used with c_f_procpointer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shared_library_type), | intent(in) | :: | self |
Handle on a loaded library |
||
| character(len=*), | intent(in) | :: | name |
Name of the exported procedure |
||
| type(state_type), | intent(out), | optional | :: | err |
Optional state return flag. On error, if not requested, the code stops |
Address of the procedure, c_null_funptr on error
type :: shared_library_type private !> OS handle returned by `dlopen` / `LoadLibraryExW` type(c_ptr) :: handle = c_null_ptr !> Path of the file that was actually loaded character(len=:), allocatable :: path contains !> Load a shared library into this handle procedure :: open => lib_open !> Address of an exported procedure procedure :: symbol => lib_symbol !> Address of an exported variable procedure :: data => lib_data !> Test whether a symbol is exported procedure :: has_symbol => lib_has_symbol !> Unload the library procedure :: close => lib_close !> Test whether a library is currently loaded procedure :: is_loaded => lib_is_loaded !> Path of the file that was actually loaded procedure :: filename => lib_filename end type shared_library_type