wiki.icculus.org
[ front page | index | search | recent changes | git repo | offline html ]

CategoryMojoELF

The latest version of MojoELF can be found at:

https://github.com/icculus/mojoelf

MojoELF is an ELF binary loader that runs in your application, instead of as part of the C runtime. Its most useful feature is that, unlike the standard dlopen(), it can load an ELF file from a place other than the filesystem. Notably, it can load one from a buffer in memory.

It can also be useful for overriding specific parts of the dependency management process, such as loading a replacement library or quietly replacing a function, etc.

To use MojoELF:

  #define MOJOELF_SUPPORT_DLERROR 0  // remove MOJOELF_dlerror() + lots of strings.
  #define MOJOELF_SUPPORT_DLOPEN_FILE 0 // remove MOJOELF_dlopen_file()
  #define MOJOELF_REDUCE_LIBC_DEPENDENCIES 0  // use less libc calls. Scary!
  #define NDEBUG 1  // Turns off assert, which removes libc dependencies.
typedef int (*my_fn_type)(int argument);
my_fn_type my_function = (my_fn_type) MOJOELF_dlsym(lib, "AwesomeFunc");
if (my_function == NULL) {
    printf("couldn't find AwesomeFunc!\n");
} else {
    printf("AwesomeFunc() returns %d\n", my_function(123));
}

Thread safety:

MojoELF provides no locking mechanisms, and has a piece of global state that almost any function can set (the MOJOELF_dlerror() state). As such, the app is responsible for providing a serialization method if they plan to use MojoELF from multiple threads at once.

Other stuff:

Please see the file LICENSE.txt in the source's root directory for licensing and redistribution rights.

Functions

Datatypes

Structs

Enums

Macros


CategoryAPICategory


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.