-
Notifications
You must be signed in to change notification settings - Fork 341
Add support for passing ABI version to FFI.map_library_name.
#963
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
Conversation
|
cc @headius |
|
@larskanis what do you think about merging this? |
larskanis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @ioquatix for not responding earlier! I like the addition but added two comments to discuss.
| end | ||
|
|
||
| def to_s | ||
| if root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see much value to pass root through LibraryPath. It can be equally prepended externally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a more convenient interface:
e.g.
lib_path = __dir__ # or something
ffi_lib LibraryPath.new('vips', 42, lib_path)It's easier to understand the intention of the user (a library in a given path) and easier to print out/debug later on.
A lot of native libraries follow this pattern, i.e. compile a shared library into a known path.
In theory, if someone provides a value of "/foo/bar/mylib.so", that would be split into a root and a name. However, in that case, the string is just returned since there is no point to manipulate it further. Without root we couldn't represent such values.
| end | ||
| else | ||
| # Otherwise we just use a generic format: | ||
| "#{Platform::LIBPREFIX}#{name}.#{Platform::LIBSUFFIX}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to preserve the LIBSUFFIX-addition like so
lib = "#{Platform::LIBPREFIX}#{name}"
r = Platform::IS_WINDOWS || Platform::IS_MAC ? "\\.#{Platform::LIBSUFFIX}$" : "\\.so($|\\.[1234567890]+)"
lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/
libCommit c95b8f3 removed a possibly already present ABI version number.
Commit c95b8f3 removed a possibly already present ABI version number.
Fixes #728
cc @larskanis :)