LibSharedMemoryObject provides a simple API to load from memory shared library on both Linux (.so) and Windows (.dll).
Example of use of API without error handling for sake of simplicity.
smo_handle *handle;
typedef void(*hello_world_func)(void);
hello_world_func hello_world;
/* Where buffer and size are the content of your memory library */
handle = smo_open("your_id", buffer, size);
/**
* hello world is now a ptr of the function hello_world()
* located in the memory library
*/
hello_world = smo_get_function(handle, "hello_world");
/* Print the hello world message from library */
hello_world();
smo_close(handle);
And that's all you need !
- LibErrorInterceptor, a lightweight and cross-plateform library to handle stacktrace and logging in C99.
- LibUnknownEchoUtilsModule Utils module of LibUnknownEcho. Last version.
- The Windows implementation is from MemoryModule, a library to load DLL from memory.
- The Linux implementation opened a file descriptor in rams with
shm_open()
or the syscall__NR_memfd_create
based on you Kernel version.
Tested on:
- Windows x86
- Windows 64
- Ubuntu 14.04
- Ubuntu 16.04