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

Compiler hint for dynlib pragmas to display string used for library name resolution #14419

Open
samdmarshall opened this issue May 21, 2020 · 0 comments

Comments

@samdmarshall
Copy link
Contributor

Summary

Requesting that a new hint, or comparable functionality be added to the compiler to display the strings that get used by the dynlib pragma, to be used in conjunction with the --dynlibOverride flag.

Description

Currently, whenever the dynlib pragma is used in code, that gets compiled into a forced load of a library matching the pattern defined with the pragma. The existing behavior matches the supplied argument to the --dynlibOverride flag to the full library name, such that the two strings don't have to be identical. This is demonstrated in the current documentation, being able to supply --dynlibOverride:lua to match the pragma definition of {. dynlib: liblua.so .}. However this can become more complex when the library name is variable; e.g.:
{. ... dynlib: "(libmysqlclient|libmariadbclient).so(|.20|.19|.18|.17|.16|.15)" ... .}

The implementation details of this example resolve as two separate run-time errors:

  1. inability to load "libmysqlclient.so/.dylib/.dll"
  2. inability to load "libmariadbclient.so/.dylib/.dll"

So, to the developer it appears to be necessary to declare two additional --dylibOverride flags, when in-fact this will not resolve the problem.

The necessary fix would be a single --dynlibOverride flag passed with the argument "(libmysqlclient|libmariadbclient)". This would correctly handle the given case of loading a library of the variant name due to the way the dynlib requirement is defined in the code.

Alternatives

  1. Add a new Hint to the compiler that would echo (to stdout) a string that can be used with the --dynlibOverride flag for matching that particular library, plus additional information as to what library that string would be tied to (where the use of the dynlib pragma is in the code). This hint should default to off state.
  2. Additional documentation surrounding how the argument to the --dynlibOverride flag gets interpreted into the library identifier defined in the pragma. The current documentation is sufficient for most cases but uses vague wording with how it actually works, could be more clear/explicit.
  3. Add functionality to existing --dynlibOverrideAll flag to echo information suggested in method 1. (implement method 1, but without use of a new compiler hint)

Additional Information

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

No branches or pull requests

1 participant