pub unsafe extern "C" fn rb_define_variable(
name: *const c_char,
var: *mut VALUE,
)Expand description
“Shares” a global variable between Ruby and C. Normally a Ruby-level global variable is stored somewhere deep inside of the interpreter’s execution context, but this way you can explicitly specify its storage.
static VALUE foo;
extern "C" void
init_Foo(void)
{
foo = [`rb_eval_string`]"...");
[`rb_define_variable`]"$foo", &foo);
}In the above example a Ruby global variable named $foo is stored in a C
global variable named foo.
§@param[in] name Variable (Ruby side).
@param[in] var Variable (C side).
@post Ruby level global variable named name is defined if absent,
and its storage is set to var.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3