##- Bitte geben Sie Ihre Antwort über dieser Zeile ein. -##
Sie sind in dieser Supportanfrage (1955167) auf CC gesetzt. Antworten Sie
auf diese E-Mail, um Kommentare zur Anfrage hinzuzufügen.
*Ruby users*
27. Feb. 2023, 22:24 MEZ
Hi,
In <CAD489_xmJUsZkPzzbhJPXi3naKn18fpt+Dj1_uVYf945p9FeZA@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@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:
>
openssl/ossl.h at ea0a112a0c6a0498629e778af7991c9b4e349565 · ruby/openssl · GitHub
> (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:
mysql2-replication/extconf.rb at main · groonga/mysql2-replication · GitHub
Thanks,
--
kou
______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info --
Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org
*Ruby users*
27. Feb. 2023, 21:28 MEZ
On 2/27/23, Tiago Cardoso via ruby-talk <ruby-talk@ml.ruby-lang.org> > wrote:
> Hi Mohit,
> ... I want to access the headers of openssl "the ruby library", or more
specifically its C extension headers.
So, you mean, e.g., these:
openssl/ext/openssl at master · ruby/openssl · GitHub
openssl/ossl.h at master · ruby/openssl · GitHub
It doesn't look like the extension installs those headers:
openssl/extconf.rb at master · ruby/openssl · GitHub
E.g., ruby/digest installs digest.h
digest/extconf.rb at master · ruby/digest · GitHub
$INSTALLFILES = {
"digest.h" => "$(HDRDIR)"
} if $extmk
______________________________________________
ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org
To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org
ruby-talk info --
Info | ruby-talk@ml.ruby-lang.org - ml.ruby-lang.org
*Ruby users*
27. Feb. 2023, 20:34 MEZ
Hi Mohit,
Thx for the reply. "#include <openssl/ossl.h>" is to access headers from
openssl "the library", whereas I want to access the headers of openssl "the
ruby library", or more specifically its C extension headers.
Both "#include <ruby/ruby.h>" and "#include <sys/time.h>" do not apply to
my use-case: the first is a header file from the ruby distribution, not an
stdlib, whereas the latter is a (non-ruby related) system library.
Best regards,
Tiago
Mohit Sindhwani <mo_mail@onghu.com> escreveu no dia segunda, 27/02/2023
à(s) 16:35:
Hi Tiago,
On 2023-2-27 7:27 pm, Tiago Cardoso via ruby-talk 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:
openssl/ossl.h at ea0a112a0c6a0498629e778af7991c9b4e349565 · ruby/openssl · GitHub
(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.
The beginning of my C file looks like:
#include <ruby.h>
#include <openssl/evp.h>
#include <pathto/openssl/ossl.h> // how to do this?
What is the error that you are getting? I would have that it should just
work with "#include <openssl/ossl.h>" on the idea that it's relative to the
system include directory but I am still exploring how C native extensions
work but I thought it should have worked since I see other gems (e.g.,
grpc) include other items like:
#include <ruby/ruby.h>
#include <sys/time.h>
Best regards,
Mohit.
*Ruby users*
27. Feb. 2023, 12:28 MEZ
Hi,
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:
openssl/ossl.h at ea0a112a0c6a0498629e778af7991c9b4e349565 · ruby/openssl · GitHub
(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.
The beginning of my C file looks like:
#include <ruby.h>
#include <openssl/evp.h>
#include <pathto/openssl/ossl.h> // how to do this?
Thx,
Tiago
Avocado Store GmbH
Cremon 32, 20457 Hamburg
avocadostore.de <https://www.avocadostore.de> - Eco Fashion & Green
Lifestyle
[image: Instagram] <https://www.instagram.com/avocadostore.de>
[image: Facebook] <Facebook;
[image: Pinterest] <https://pinterest.com/avocadostore>
[image: TikTok] <https://www.tiktok.com/@avocadostore.de>
[image: LinkedIn] <https://www.linkedin.com/company/avocadostore>
Eine E-Mail verursacht durchschnittlich 4 g CO2, mit Anhang bis zu 50 g.
Jährlich bedeutet das 135 kg CO2-Emissionen pro Kopf. Verringere deine
Emissionen, indem du nur notwendige E-Mails verschickst und regelmäßig
E-Mails löschst.
Registergericht: Amtsgericht Hamburg, HRB 113545
Umsatzsteuer-Identifikationsnummer: DE270706065
Geschäftsführung: Mimi Sewalski & Till Junkermann
[V03OR4-EQ4Z8]