Project

General

Profile

Actions

Feature #15338

open

Provide way for C extensions to query if global variable is defined

Added by graywolf (Gray Wolf) over 5 years ago. Updated over 5 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:90046]

Description

As far as I can tell, there is no way for C extension to check if global variable is defined. I can rb_gv_get, but that produces warning when $VERBOSE = true.

Let's introduce third function rb_gv_defined to complement rb_gv_get and rb_gv_set.

PS: At the moment I'm doing if (RTEST(rb_eval_string("defined?($XX) && $XX"))) { ... } but there's got to be a better way, right?


Files

0001-Add-rb_gv_defined.patch (3.42 KB) 0001-Add-rb_gv_defined.patch graywolf (Gray Wolf), 11/24/2018 08:21 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0