Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to do a "dlsym(0, decorated_name)"-type access of pre-loaded plugin so #13

Closed
rpavlik opened this issue Apr 13, 2016 · 4 comments

Comments

@rpavlik
Copy link
Member

rpavlik commented Apr 13, 2016

In the case where some external entity has already loaded the shared library plugins into the address space for us, it would be good to have API to essentially (in libdl terms here) wrap

dlsym(nullptr, "libfunc_ep_" + pluginname); // the expression in the latter argument is the runtime form of LIBFUNC_DETAIL_EP_NAME(PLUGINNAME)

It would only initially work on non-DLL (non-Windows) platforms where all symbols get exported (since Windows we only currently export the single commonly-named trampoline entry point), but since it would be most useful in weird/constrained deployment scenarios (think Android) - that would be OK.

cc @JeroMiya

@rpavlik
Copy link
Member Author

rpavlik commented Apr 13, 2016

So actually this wouldn't need new API - it would just be an additional step in the existing implementation, based on a decision of semantics: do you check for an already-loaded library before or after you try to load the library you've been told to? In the first case, you try the dlsym(0) before the library loading, and the second case, you try it after library loading fails, before throwing an exception. Would want to slightly refactor the implementation to get the funny entry point casting in its own function so you could pass 0 or a real handle in as the first arg to dlsym, but either way, not too bad overall.

@JeroMiya
Copy link
Contributor

Something like this? (coding blind)

image

@rpavlik
Copy link
Member Author

rpavlik commented Jul 14, 2018

I suspect we already did this, especially given your code above, @JeroMiya - is that correct?

@rpavlik
Copy link
Member Author

rpavlik commented Jul 16, 2018

Yeah this is already there (useful on Android, etc), except on Windows - see #17 .

@rpavlik rpavlik closed this as completed Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants