Skip to content

Commit 8b4a7b3

Browse files
committed
[GR-18163] Use the filename until the first dot to compute the Init_ function
PullRequest: truffleruby/4106
2 parents 29fb038 + 8ad171f commit 8b4a7b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ def self.init_libtrufflerubytrampoline(libtrampoline)
206206
end
207207

208208
def init_extension(library, library_path)
209-
name = File.basename(library_path, '.*')
209+
name = File.basename(library_path)
210+
# We need the substring before the first dot, for "cool.io_ext.so" -> "Init_cool"
211+
i = name.index('.')
212+
name = name[0...i] if i
210213
function_name = "Init_#{name}"
214+
211215
init_function = library[function_name]
212216
begin
213217
Primitive.call_with_c_mutex_and_frame(VOID_TO_VOID_WRAPPER, [init_function], nil, nil)

0 commit comments

Comments
 (0)