Skip to content

LibSharedMemoryObject provides a simple API to load from memory shared library on both Linux (.so) and Windows (.dll)

License

Notifications You must be signed in to change notification settings

swasun/LibSharedMemoryObject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c1eb6e0 · Feb 4, 2019

History

25 Commits
Jul 26, 2018
Jul 26, 2018
Jul 26, 2018
Jul 25, 2018
Jul 26, 2018
Jun 16, 2018
Jul 26, 2018
Feb 4, 2019
Jul 23, 2018
Jul 22, 2018
Jun 15, 2018
Jun 15, 2018
Jul 23, 2018

Repository files navigation

Description

LibSharedMemoryObject provides a simple API to load from memory shared library on both Linux (.so) and Windows (.dll).

API

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 !

Dependencies

Implementation

  • 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.

Cross-plateform

Tested on:

  • Windows x86
  • Windows 64
  • Ubuntu 14.04
  • Ubuntu 16.04

About

LibSharedMemoryObject provides a simple API to load from memory shared library on both Linux (.so) and Windows (.dll)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published