DyLibSymbol
Returns the address of a function or variable in a dll
Declare Function DyLibSymbol ( ByVal library As Any Ptr, ByRef symbol As String ) As Any Ptr
Declare Function DyLibSymbol ( ByVal library As Any Ptr, ByVal symbol As Short ) As Any Ptr
result = DyLibSymbol ( library, symbol )
library
symbol
DyLibSymbol returns a pointer to the variable or function named symbol , in the dll pointed by libhandle. libhandle is obtained by loading the dll with DyLibLoad. The symbol must have been Exported in the dll.
If libhandle is 0, the symbol is searched in the current executable or dll.
If using cdecl functions, only the name of the procedure needs to be specified. If dynamically linking to a function created using STDCALL (default in windows), then the function must be decorated. To decorate a function, use its name, '@', then the number of bytes passed as arguments. For instance if the function FOO takes 3 integer arguments, the decorated function would be 'FOO@12'. Remember, without an explicit Alias, the procedure name will be uppercase.
If linking to a dll created in Visual C++(tm), decoration need not be used. For GCC, decoration is needed.
Note: The dylibsymbol, if failing, will attempt to automatically decorate the procedure, from @0 to @256, in 4 byte increments.
Syntax
Declare Function DyLibSymbol ( ByVal library As Any Ptr, ByRef symbol As String ) As Any Ptr
Declare Function DyLibSymbol ( ByVal library As Any Ptr, ByVal symbol As Short ) As Any Ptr
Usage
result = DyLibSymbol ( library, symbol )
Parameters
library
symbol
Return Value
Description
DyLibSymbol returns a pointer to the variable or function named symbol , in the dll pointed by libhandle. libhandle is obtained by loading the dll with DyLibLoad. The symbol must have been Exported in the dll.
If libhandle is 0, the symbol is searched in the current executable or dll.
If using cdecl functions, only the name of the procedure needs to be specified. If dynamically linking to a function created using STDCALL (default in windows), then the function must be decorated. To decorate a function, use its name, '@', then the number of bytes passed as arguments. For instance if the function FOO takes 3 integer arguments, the decorated function would be 'FOO@12'. Remember, without an explicit Alias, the procedure name will be uppercase.
If linking to a dll created in Visual C++(tm), decoration need not be used. For GCC, decoration is needed.
Note: The dylibsymbol, if failing, will attempt to automatically decorate the procedure, from @0 to @256, in 4 byte increments.
Example
Platform Differences
- Dynamic link libraries are not available in DOS ,as the OS doesn't support them.
- Ordinals are not supported on Linux, 0 is always returned.
Dialect Differences
- Not available in the -lang qb dialect unless referenced with the alias __Dylibsymbol.
Differences from QB
- New to FreeBASIC
See also