Questions tagged [ruby-c-extension]

Loadable modules written in C which provide additional functionality for the Ruby language.

C extensions are shared objects that can be loaded by the MRI at runtime. They are typically created in order to allow Ruby to interface with low-level code, but can also used to improve the speed of expensive computations.

Many modules in the Ruby standard library are implemented as C extensions in order to optimize for speed or reuse existing libraries.

176 questions
0
votes
1 answer

Error with ruby bundle install

When I try to running bundle install I see: To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86- mingw32/2.3.0/nio4r-2.1.0/mkmf.log extconf…
0
votes
1 answer

How to call exit from a script loaded via rb_load_protect without a segfault

I want to quit the application with success from Ruby 2.3.3 (Win32). I get a segfault when I try to exit the program from that script. I tried the following: # script.rb loop do # do something exit 0 if foo() break if bar() end foo and…
Sisyphe
  • 146
  • 1
  • 13
0
votes
1 answer

have_header from mkmf throws an error in Jruby

I have this test code : require 'mkmf' puts have_header("iostream.h") this code throws an error in Jruby like this : checking for iostream.h... RuntimeError: The compiler failed to generate an executable file. You have to install development…
niceman
  • 2,653
  • 29
  • 57
0
votes
0 answers

How do I execute a ruby script when gem install is called?

I'm making a Ruby wrapper for a C Library that doesn't really have a system wide installation(the libxxx.a linkable library is distributed). During development, I was able to just keep this .a file in a local folder and refer to it using the C…
fibonachoceres
  • 727
  • 4
  • 14
0
votes
1 answer

How to compile Ruby c extension on Ruby 2.2.1 for sketchup plugin?

I have used a Ruby C Extension for SketchUp Plugin. Ruby version is 1.9.3 and SketchUp2016. But I have to recompile the Ruby C extension to upgrade the plugin package that supports ruby version of 2.2.1 P85.
user6303986
0
votes
0 answers

Executing a method of an object passed to a Ruby C extension

I am attempting to write a Ruby extension in C and am having an issue calling a method of a object that is passed into the extension. For example, I have a ruby class defined as follows: class MyClass def write(message) ...do a write... …
jstephens
  • 1
  • 2
0
votes
2 answers

Use gems with c-extensions in JRuby, or port them to Java?

I'm doing a fuzzy match test between an input string and some previously entered strings. The test is performed live while typing. I already have a shockingly accurate algorithm in place called StrikeAMatch, which has been translated into many…
Cjoerg
  • 1,271
  • 3
  • 21
  • 63
0
votes
1 answer

Error on create a Ruby extension in C

sample ⇒Source code(include makefile) I make a test for the sample above, But when I compile it got error ! Did I do it wrong? H:\Ruby\test_ymal\MyTest>make compiling MyTest.c In file included from…
nainaigu
  • 147
  • 2
  • 13
0
votes
1 answer

ArgumentError: string contains null byte when use StringValueCStr

here is my test file here is my full code (github.com/roroco/ro_article/tree/string-contains-null-byte) I get "ArgumentError: string contains null byte" when run following code: in ruby side: get_article(File.read("test_file")) In c side: VALUE…
anzeaucha
  • 157
  • 6
0
votes
1 answer

Read array element and convert into string

if (RARRAY_LEN(arr) > 0) { VALUE str = rb_ary_entry(arr, 0); abc = some_method(*str); } rb_ary_entry(arr, 0) gives me an index value. Then I want to convert that value to a string so I can pass it to the next method. I…
mandss
  • 91
  • 6
0
votes
1 answer

Extending Ruby in C - converting arguments to c types

How I can do similar for ruby. I am not able to find a example/documentation for casting a variable to object. For example Local obj = args[0]->ToObject(); Local props = obj->GetPropertyNames(); I am re-writing a node extension in…
mandss
  • 91
  • 6
0
votes
1 answer

Wrapping Ruby With An Anonymous Module

There are several Ruby C API functions for running some Ruby code. Most just run the code in an isolated binding like require does. But some of them first wrap the code in an anonymous module before running it. For example, rb_load takes an argument…
Max
  • 21,123
  • 5
  • 49
  • 71
0
votes
1 answer

Installing ruby-oci8 with jruby

Trying to install ruby-oci8 with jruby gemset. It's giving me below error I've tried to use export JRUBY_OPTS="--1.9 -Xcext.enabled=true" as suggested in other similar questions with no luck. $ jruby -S gem install ruby-oci8 Fetching:…
mukh007
  • 339
  • 1
  • 6
  • 17
0
votes
0 answers

Ruby require wrong argument type error

I implement ruby extension in c++. it compiled. but when i require module which i implement in my ruby test, it show an error. i create similar small module and require it same way in ruby code. it work fine. i can't figure out what is the problem.…
Kelum Deshapriya
  • 258
  • 4
  • 14
0
votes
1 answer

Ruby C extension vs Spawn Exectuable via #system

I have some Ruby code that interacts with a C application. Right now, it spawns the executable using the Kernel#system method each time it needs to pass data to the application. What are the advantages/disadvantages system-side with this approach…
Chris Ledet
  • 11,458
  • 7
  • 39
  • 47
1 2 3
11
12