|
infix
A JIT-Powered FFI Library for C
|
Cookbook Chapter 5: Calling C++ Mangled Names. More...
Functions | |
| int | main () |
Variables | |
| const char * | LIB_NAME = "./libmyclass.so" |
Cookbook Chapter 5: Calling C++ Mangled Names.
This example demonstrates the advanced and fragile technique of manually replicating the C++ new and delete operators from C.
This is a two-step process:
new: First, allocate raw memory (malloc), then call the constructor on that memory with its mangled name.delete: First, call the destructor with its mangled name, then free the raw memory (free).extern "C" factory functions (create_object/destroy_object) to hide this complexity. | int main | ( | void | ) |
| const char* LIB_NAME = "./libmyclass.so" |