Platforms to show: All Mac Windows Linux Cross-Platform

DeclareCallBackMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for a callback for use in declares.

Allows you to dynamically create callback functions.
Pass the function pointer to a C function which later calls back your callback.

Please make sure this callback object stays alive, e.g. stored in a global property. When the object is released and the callback later invoked, the application will crash.

When you code sign on macOS, you may need to use the entitlement for just-in-time compiler and for unsigned executable memory, e.g. the com.apple.security.cs.allow-unsigned-executable-memory entitlement.

Call Modes

Constant Value Description
kCallModeARM "A" ARM calling
kCallModeARMThumb "a" ARM calling in thumb mode
kCallModeCDecl "c" x86 specific CDecl
kCallModeDefault ":" Default calling conv (platform native)
kCallModeEllipsisVarargs "." C ellipsis function call (variable/unnamed arguments (after ’...’))
kCallModeSysCall "$" SysCall mode
kCallModeThisCallGNU "#" x86 specific, GNU C++ this calls are cdecl, but keep specific sig char for clarity.

Calling Conventions

Constant Value Description
kCallModeEllipsis "e" C ellipsis function call
kCallModeFastCallGNU "f" C x86 Windows GCC fast call
kCallModeFastCallMS "F" C x86 Windows Microsoft fast call
kCallModePrefix "_" The character to indicate that next character in the signature is a calling convention prefix.
kCallModeStdCall "s" C x86 Windows standard call
kCallModeThisCallMS "+" C x86 Windows Microsoft this call

Types

Constant Value Description
kTypeBool "B" bool
kTypeChar "c" char, 8 bit signed byte
kTypeDouble "d" Double, 64-bit and 8 bytes big.
kTypeEndArg ")" end of arguments symbol.
kTypeFloat "f" Single, 32-bit and 4 bytes big.
kTypeInt "i" 32-bit signed integer.
kTypeInt64 "l" 64-bit signed integer.
kTypeLong "j" 32/64-bit signed integer.
64-bit only for MacOS and Linux in 64-bit application.
Always 32-bit on Windows.
kTypePtr "p" Pointer. Maybe a reference to an object or array.
kTypeShort "s" 16-bit signed integer.
kTypeString "Z" C String with zero byte as terminator.
kTypeStruct "T" Structure
kTypeUnsignedChar "C" 8 bit unsigned byte
kTypeUnsignedInt "I" 32-bit unsigned integer.
kTypeUnsignedInt64 "L" 64-bit unsigned integer.
kTypeUnsignedLong "J" 32/64-bit unsigned integer.
64-bit only for MacOS and Linux in 64-bit application.
Always 32-bit on Windows.
kTypeUnsignedShort "S" 16-bit unsigned integer.
kTypeVoid "v" Nothing to return.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes


The items on this page are in the following plugins: MBS Util Plugin.


DDEStringPairMBS   -   DeclareFunctionMBS


The biggest plugin in space...