Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement loading functions from static linked libraries #1
It sounds like you want to resolve a symbol at runtime, which is exactly what
This seems out of this project's scope, but could be a fairly simple crate.
If you want to search all loaded dynamic libs:
let func = Function::new(dynsym::load_sym("printf", dynsym::Search)); //on linux, maps pretty much to let func = Function::new(dlsym("printf", RTLD_DEFAULT)) //on windows, we emulate RTLD_DEFAULT by feeding the modules returned from EnumProcessModules through GetProcAddress, until we find "printf"
Or, if you know what library contains printf:
// LoadLibrary("msvcrt.dll") on win, dlopen("libc.so") on nix let libc = dynsym::load_libc(); // GetProcAddress("printf", libc) on win, dlsym("printf", libc) on nix let func = Function::new(dynsym::load_sym("printf", libc));