ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: cfis@savagexi.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:102637] [Ruby master Bug#17643] Ruby 3 embedded - no GC methods?
Date: Sat, 27 Feb 2021 08:54:55 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-90629.20210227085455.91@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17643.20210219050440.91@ruby-lang.org

Issue #17643 has been updated by cfis (Charlie Savage).


Just followin up. Nobu any thoughts?

----------------------------------------
Bug #17643: Ruby 3 embedded - no GC methods?
https://bugs.ruby-lang.org/issues/17643#change-90629

* Author: cfis (Charlie Savage)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The following code works on Ruby 2.x, but not on Ruby 3.0.0.

``` c
// Initialize Ruby VM
int argc = 0;
char* argv = (char*)malloc(1);
argv[0] = 0;
char** pArgv = &argv;

ruby_sysinit(&argc, &pArgv);
ruby_init();
ruby_init_loadpath();

// Try to call GC.start
int state;
VALUE result = rb_eval_string_protect("GC.start", &state);
VALUE err = rb_errinfo();
VALUE rubyMessage = rb_funcall(err, rb_intern("message"), 0);
char* message = RSTRING_PTR(rubyMessage);

message is "undefined method `start' for GC:Module"

```

This is true for all the GC methods (stop, stress, etc). Note if you create a Ruby script that contains GC.start and run it using the Ruby interpreter all is well.

Is there some new special way Ruby 3 needs to be embedded?

Note I tested this on mingw, MSVC and gcc (Fedora). All the same. Like I said above, this code works fine on Ruby 2.7 and earlier.



-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2021-02-27  8:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-17643.20210219050440.91@ruby-lang.org>
2021-02-27  8:54 ` cfis [this message]
2021-03-08  5:37 ` [ruby-core:102769] [Ruby master Bug#17643] Ruby 3 embedded - no GC methods? nobu
2021-04-02  8:39 ` [ruby-core:103172] " cfis
2021-04-02  8:41 ` [ruby-core:103173] " cfis
2021-08-21  1:54 ` [ruby-core:105037] " nobu (Nobuyoshi Nakada)
2021-08-21  6:27 ` [ruby-core:105038] " cfis (Charlie Savage)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-90629.20210227085455.91@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).