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

Various improvements to dynamic backend loading #1169

Merged
merged 9 commits into from
Oct 10, 2024
Merged

Conversation

vadz
Copy link
Member

@vadz vadz commented Oct 7, 2024

Improve error messages and the default path for loading, especially under Unix, where dlopen() doesn't look into the directory containing the loading module by default.

Show the exact library name in the error message to give the users a
fighting chance to figure what's going on.

Also report the extra search path, which can be useful as well.
Don't show just "." in the error message, this is not really useful.
By default, i.e. if the application doesn't call ::SetErrorMode()
itself, any failure inside LoadLibrary() shows error message boxes that
are unexpected and not useful, as we're prepared to handle the errors
ourselves.

Disable these message boxes for the duration of do_register_backend()
execution.
Using "handler" instead of "handle" was confusing, so rename the type
and also the name of the variable using it.

No real changes.
No real changes, just a bit of hygiene.
In the future we should get rid of this code completely and just use
std::mutex, but this commit just makes things a bit less ugly without
changing anything else.
This seems preferable to loading them from the current directory, which
we did until now.

The backends load path can still be overridden by defining
SOCI_BACKENDS_PATH environment variable at run-time or appended to by
defining DEFAULT_BACKENDS_PATH at build time.
Don't do it eagerly on the program startup, the application may end up
not opening any databases at all, so wait until we actually need them.
Use return value of std::map::erase() now that we do use C++11.

No real changes, just simplify the code a bit.
@vadz vadz merged commit af89e52 into SOCI:master Oct 10, 2024
16 checks passed
@vadz vadz deleted the dyn-load-fixes branch October 10, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant