|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | callbackGetHandle(cbtype, func) _callbackGetHandle(#cbtype, (GenericCallback)((cbtype)func)) |
| #define | callbackGetFunc(cbtype, handle) ((cbtype)_callbackGetFunc(#cbtype, handle)) |
Typedefs | |
| typedef void(* | GenericCallback) () |
| Generic callback function pointer type. | |
Generic callback handle system for storing and retrieving function pointers with type safety.
This older system converts function pointers to integer handles that can be stored and retrieved later. It provides basic type checking by storing the function signature as a string.
Why this is deprecated:
For new code, use:
| #define callbackGetFunc | ( | cbtype, | |
| handle | |||
| ) | ((cbtype)_callbackGetFunc(#cbtype, handle)) |
cbtype callbackGetFunc(cbtype, handle)
Retrieve a typed function pointer from a handle.
Looks up the function pointer associated with the handle and verifies the type matches. Returns NULL if the handle is invalid or the type doesn't match.
| cbtype | Expected function pointer type |
| handle | Handle returned by callbackGetHandle() |
Definition at line 66 of file cbhandle.h.
| #define callbackGetHandle | ( | cbtype, | |
| func | |||
| ) | _callbackGetHandle(#cbtype, (GenericCallback)((cbtype)func)) |
int callbackGetHandle(cbtype, func)
Convert a typed function pointer to an integer handle.
Stores the function pointer internally and returns a handle that can be used to retrieve it later. The function signature type is stored for basic type checking.
| cbtype | Function pointer type (e.g., myCallbackType) |
| func | Function pointer to store |
Definition at line 52 of file cbhandle.h.