Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  

CLibrary.LoadFunction

Loads a function from a library.

Component Version macOS Windows Linux Server iOS SDK
CFunction 10.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CLibrary.LoadFunction"; LibraryRef; Name; Signature )   More

Parameters

Parameter Description Example
LibraryRef The reference number for the library. $lib
Name The name of the function.

Please see CLibrary.Symbols to get a list of available symbol names.
"zlibVersion"
Signature The signature text. "()Z"

Result

Returns function reference number or error.

Description

Loads a function from a library.
You need to pass a signature to the function parameters and return types. Signature has format of parameters in brackets and return type attached.
e.g. if function takes an integer and a 32-bit float and returns a boolean, you would declare it as "(if)B".
For array Parameters, please use p for pointer.
If needed, you can prefix signature with a calling convention prefix.

TypeNameDescription
vvoidnothing
BBOOLBoolean value
ccharsigned 8 bit value
Cunsigned charunsigned 8 bit value
sshortsigned 16 bit value
Sunsigned shortunsigned 16 bit value
iintsigned 32 bit value
Iunsigned intunsigned 32 bit value
jlongfor Windows 32-bit value, for MacOS and Linux 64-bit value
Junsigned longfor Windows 32-bit value, for MacOS and Linux 64-bit value
llong longsigned 64 bit value
Lunsigned long longunsigned 64 bit value
ffloatfloating point number in 32-bit size
ddoublefloating point number in 64-bit size
ppointerpointer in 32 or 64-bit.
ZC StringC style string with zero byte as end.

PrefixNameDescription
DefaultNormal C function without prefix
_eEllipsisC function taking variable arguments
_sstdcallstandard calling convention
_ffastcall GNUFastcall convention as used in GNU compilers
_Ffastcall MicrosoftFastcall convention as used in Microsoft compilers
_+thiscall MicrosoftThiscall convention as used in Microsoft compilers

Examples

Load zlibVersion function:

MBS( "CLibrary.LoadFunction"; $lib; "zlibVersion"; "()Z" )

See also

Created 25th April 2020, last changed 24th July 2020


CLibrary.Load - CLibrary.Name

Feedback: Report problem or ask question.