Module: MiniRacer::Loader

Defined in:
ext/mini_racer_loader/mini_racer_loader.c

Class Method Summary collapse

Class Method Details

.load(fname) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ext/mini_racer_loader/mini_racer_loader.c', line 15

static VALUE _load_shared_lib(VALUE self, volatile VALUE fname)
{
    (void) self;

    // check that path is not tainted
    SafeStringValue(fname);

    FilePathValue(fname);
    VALUE path = rb_str_encode_ospath(fname);

    char *loc = StringValueCStr(path);
    void *handle = _dln_load(loc);

    return handle ? Qtrue : Qfalse;
}