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

mj_loadPluginLibrary should return the handle to the loaded library #2130

Open
PeterOGB opened this issue Oct 9, 2024 · 2 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@PeterOGB
Copy link

PeterOGB commented Oct 9, 2024

The feature, motivation and pitch

Currently mj_loadPluginLibrary returns void. It would be helpful if it returned the void * handle to the loaded library as returned by dlopen (Or the win32 equivalent) . This would allow applications to fail early if the library file is not found at the given location.

Alternatives

No response

Additional context

No response

@PeterOGB PeterOGB added the enhancement New feature or request label Oct 9, 2024
@saran-t
Copy link
Member

saran-t commented Oct 18, 2024

I'm open to this. Would you like us to implement it or do you want to send us a PR?

@jjyyxx
Copy link
Contributor

jjyyxx commented Oct 21, 2024

@saran-t Also, I suggest that mj_loadPluginLibrary should log the error (from dlerror, etc.) to stderr if loading fails. The current behavior of returning silently is quite misleading (plus there is no Python API to check plugin status). Last time when my plugin fails to load (fault on my end due to incorrect linking flags, but quite subtle), I had to gdb into the mj_loadPluginLibrary function, run call dlerror() after dlopen(...) to get some hints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants