Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
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.
Type | Name | Description |
v | void | nothing |
B | BOOL | Boolean value |
c | char | signed 8 bit value |
C | unsigned char | unsigned 8 bit value |
s | short | signed 16 bit value |
S | unsigned short | unsigned 16 bit value |
i | int | signed 32 bit value |
I | unsigned int | unsigned 32 bit value |
j | long | for Windows 32-bit value, for MacOS and Linux 64-bit value |
J | unsigned long | for Windows 32-bit value, for MacOS and Linux 64-bit value |
l | long long | signed 64 bit value |
L | unsigned long long | unsigned 64 bit value |
f | float | floating point number in 32-bit size |
d | double | floating point number in 64-bit size |
p | pointer | pointer in 32 or 64-bit. |
Z | C String | C style string with zero byte as end. |
Prefix | Name | Description |
Default | Normal C function without prefix | |
_e | Ellipsis | C function taking variable arguments |
_s | stdcall | standard calling convention |
_f | fastcall GNU | Fastcall convention as used in GNU compilers |
_F | fastcall Microsoft | Fastcall convention as used in Microsoft compilers |
_+ | thiscall Microsoft | Thiscall convention as used in Microsoft compilers |
Examples
Load zlibVersion function:
MBS( "CLibrary.LoadFunction"; $lib; "zlibVersion"; "()Z" )
See also
Blog Entries
This function checks for a license.
Created 25th April 2020, last changed 24th July 2020