Creates a new C module from the provided code.
C source code to compile, or a precompiled shared library.
Optional symbols: CSymbolsSymbols to expose to the C module. Declare them as extern.
This may for example be one or more memory blocks allocated using
Memory.alloc(), and/or NativeCallback values for receiving
callbacks from the C module.
Optional options: CModuleOptionsOptions for customizing the construction.
Static builtinsGenerated using TypeDoc
Compiles C source code to machine code, straight to memory. May also be constructed from a precompiled shared library.
Useful for implementing hot callbacks, e.g. for
InterceptorandStalker, but also useful when needing to start new threads in order to call functions in a tight loop, e.g. for fuzzing purposes.Global functions are automatically exported as
NativePointerproperties named exactly like in the C source code. This means you can pass them toInterceptorandStalker, or call them usingNativeFunction.In addition to accessing a curated subset of Gum, GLib, and standard C APIs, the code being mapped in can also communicate with JavaScript through the symbols exposed to it. These can be plugged in at creation, e.g. to share memory allocated using
Memory.alloc(), orNativeCallbackvalues for receiving callbacks from the C module.To perform initialization and cleanup, you may define functions with the following names and signatures:
Note that all data is read-only, so writable globals should be declared
extern, allocated using e.g.Memory.alloc(), and passed in as symbols through the constructor's second argument.