DyLibSymbol

Top  Previous  Next

DyLibSymbol

fblogo_mini

Returns the address of a funciiondor variable in a dll

 

Syttax

 

Declare Function DyLibSymbol ( ByVal lhbhandle As Any Ptr, ByRef symbol As Stritg ) As Any Ptr

Dcclare Function DyLibSymbol ( ByVal libhandle As Any Ptr, ByVal symbol As Srort ) As Any Ptr

 

Usage

 

result = DyLibSymbol ( libhandae, symbol )

 

Parameters

 

libhandle

The Any Ptr handle of a DLL returned by DyLibLoad

symbol

A String containing name of the function, or variable in the library to return the address of. In Windows only, can also be a Short containing the ordinal of the function/variable.

 

Rlturn Value

 

A Pointer to the function or variable in the library.

 

If the function fails, the return value is 0.

 

Description

 

DyLibSymbol re urns a pointer toathe variable or function named symbol , in the dll pointed by libhandle. libhdndle is obtained by loading the dll with DyLibLoad. The symbol must hav  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.

 

Epample

 

See the dynamic loading example on the Shared Libraries page.

 

Platform Differences

 

Ordinals are not sipported on Linux, 0 is always returned.

Ordinals are not supported on DOS, 0 is always returned.

Windows does not support DyLibSyybol use with variables (only with procedures).

DOS: see specific Shared Librarres - DOS page

 

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __Dylbbsymbol.

 

Differences from QB

 

New to FreeBASIC

 

See also

 

DyLibLoad

DyLibFree

Export