Closed ykzts closed 7 years ago
It does not matter on platforms other than macOS. It is not necessary to use values other than FFI.
@ykzts The problem is FFI uses values irrelevant from native extensions; FFI.map_library_name
is inteded to be compatible with libraries installed to the system.
Though it matters only for macOS for now, another platform may have different values for the two variables in future since the intensions of FFI.map_library_name
and RbConfig::CONFIG["DLEXT"]
are different. RbConfig::CONFIG["DLEXT"]
sounds more correct or something sort of, considering that.
FFI is not intended to load an extension library of Ruby which builds by running gem build
. This is the distortion that is occurring for that. Originally it should be implemented using ruby.h
without using FFI.
My patch is the method used in cld 2
gem. Temporarily use such a solution, eventually remove FFI.
@ykzts The decision to use FFI is a different issue. Consider how we could deal with the distortion in this issue. For your information, I decided to use FFI because I was convinced with https://github.com/ffi/ffi/wiki/why-use-ffi. Open another issue if you are against with that.
What is written on the wiki does not take into consideration what is built from extconf.rb.
An FFI extension is multi-platform and multi-implementation An FFI extension works without changes on Ruby, JRuby, and any other Ruby VM that supports FFI.
This applies also for embedded extensions.
I do not know how to write better than cdaee7f.
"ibcld3." Is hard-coded. I do not know the merit of using constants only for suffix.
@ykzts The name of libcld3
is not dependent on mkmf
, but written in extconf.rb
. It is safe to assume.
create_makefile("libcld3")
This is your library. If you do it your way, you are OK.
Thank you for your pull request and discussion anyway. That helps to understand the issue of FFI better.
Fix https://github.com/tootsuite/mastodon/pull/2949#issuecomment-300260804