Hi,
In <CAD489_xmJUsZkPzzbhJPXi3naKn18fpt+Dj1_uVYf945p9FeZA(a)mail.gmail.com>
"[ruby-talk:444148] How to load ruby-openssl headers in a C extension" on Mon,
27 Feb 2023 11:27:52 +0000,
Tiago Cardoso via ruby-talk <ruby-talk(a)ml.ruby-lang.org> wrote:
I'm writing a C extension which interfaces with
ruby-openssl objects, and
the openssl API. In the process, I'm needing access to some functions which
ruby-openssl declares in the header file:
https://github.com/ruby/openssl/blob/ea0a112a0c6a0498629e778af7991c9b4e3495…
(example: ossl_raise). However, it's not clear to me how should I declare
the #include in order to access it, for a header file coming from stdlib.
Seems that ruby itself correctly places its header files (examples: ruby.h,
or ruby/io.h), but I don't see the openssl gem ones.
You can use Gem::Specification for it in your extconf.rb:
spec = Gem::Specification.find_by_name("openssl")
source_dir = File.join(spec.full_gem_path, "ext", "openssl")
$INCFLAGS += " -I#{source_dir}"
See also:
https://github.com/groonga/mysql2-replication/blob/main/ext/mysql2-replicat…
Thanks,
--
kou