Skip to content

Commit b4af2ab

Browse files
committed
Solve issues with ruby.
1 parent 4432914 commit b4af2ab

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

source/loaders/rb_loader/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,8 @@ if(Ruby_LIBRARY_NAME)
2020
else()
2121
set(Ruby_LIBRARY_NAME_PATH "${Ruby_LIBRARY}")
2222
endif()
23-
get_filename_component(Ruby_LIBRARY_NAME "${Ruby_LIBRARY_NAME_PATH}" NAME)
2423

25-
# Copy Ruby DLL into project output directory
26-
# TODO: https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies
27-
# TODO: https://gist.github.com/micahsnyder/5d98ac8548b429309ec5a35bca9366da
28-
if(Ruby_LIBRARY_NAME_PATH AND WIN32)
29-
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_OUTPUT_DIR})
30-
file(COPY "${Ruby_LIBRARY_NAME_PATH}" DESTINATION ${PROJECT_OUTPUT_DIR})
31-
endif()
24+
get_filename_component(Ruby_LIBRARY_NAME "${Ruby_LIBRARY_NAME_PATH}" NAME)
3225

3326
#
3427
# Plugin name and options

source/loaders/rb_loader/source/rb_loader_impl.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ void rb_loader_impl_discover_methods(klass c, VALUE cls, const char *class_name_
15061506
for (method_index = 0; method_index < methods_size; ++method_index)
15071507
{
15081508
VALUE rb_method = rb_ary_entry(methods, method_index);
1509-
VALUE name = rb_funcallv(rb_method, rb_intern("id2name"), 0, NULL);
1509+
VALUE name = rb_sym2str(rb_method);
15101510
const char *method_name_str = RSTRING_PTR(name);
15111511

15121512
VALUE instance_method = rb_funcall(cls, rb_intern(method_type_str), 1, rb_method);
@@ -1551,7 +1551,7 @@ void rb_loader_impl_discover_methods(klass c, VALUE cls, const char *class_name_
15511551
if (RARRAY_LEN(parameter_pair) == 2)
15521552
{
15531553
VALUE parameter_name_id = rb_ary_entry(parameter_pair, 1);
1554-
VALUE parameter_name = rb_funcallv(parameter_name_id, rb_intern("id2name"), 0, NULL);
1554+
VALUE parameter_name = rb_sym2str(parameter_name_id);
15551555
const char *parameter_name_str = RSTRING_PTR(parameter_name);
15561556

15571557
signature_set(s, args_it, parameter_name_str, NULL);
@@ -1572,7 +1572,7 @@ void rb_loader_impl_discover_attributes(klass c, const char *class_name_str, VAL
15721572
for (attributes_index = 0; attributes_index < attributes_size; ++attributes_index)
15731573
{
15741574
VALUE rb_attr = rb_ary_entry(attributes, attributes_index);
1575-
VALUE name = rb_funcallv(rb_attr, rb_intern("id2name"), 0, NULL);
1575+
VALUE name = rb_sym2str(rb_attr);
15761576
const char *attr_name_str = RSTRING_PTR(name);
15771577

15781578
log_write("metacall", LOG_LEVEL_DEBUG, "Attribute '%s' inside '%s'", attr_name_str, class_name_str);
@@ -1606,12 +1606,9 @@ int rb_loader_impl_discover_module(loader_impl impl, loader_impl_rb_module rb_mo
16061606

16071607
if (method != Qnil)
16081608
{
1609-
VALUE method_name = rb_funcallv(method, rb_intern("id2name"), 0, NULL);
1610-
1609+
VALUE method_name = rb_sym2str(method);
16111610
const char *method_name_str = RSTRING_PTR(method_name);
1612-
16131611
rb_function_parser function_parser = set_get(rb_module->function_map, (set_key)method_name_str);
1614-
16151612
loader_impl_rb_function rb_function = NULL;
16161613

16171614
if (function_parser == NULL)
@@ -1666,7 +1663,7 @@ int rb_loader_impl_discover_module(loader_impl impl, loader_impl_rb_module rb_mo
16661663
{
16671664
if (RB_TYPE_P(constant, T_SYMBOL))
16681665
{
1669-
VALUE class_name = rb_funcallv(constant, rb_intern("id2name"), 0, NULL);
1666+
VALUE class_name = rb_sym2str(constant);
16701667
const char *class_name_str = RSTRING_PTR(class_name);
16711668
VALUE cls = rb_const_get_from(rb_module->module, rb_intern(class_name_str));
16721669
loader_impl_rb_class rb_cls = malloc(sizeof(struct loader_impl_rb_class_type));

0 commit comments

Comments
 (0)