All Questions
478
questions
0
votes
0
answers
76
views
For Ruby extension, how should I save a reference in C or Rust side?
I'm working on a client-side caching library that caches objects in a HashMap.
A simple example is below:
fn insert(key: RString, obj: AnyObject) -> AnyObject {
let rust_struct = self....
2
votes
0
answers
162
views
How to call "unpack" on a string in ruby C-api?
I am trying to use the ruby C-api to call unpack on a ruby string.
Here is my current code:
#include "ruby.h"
#include <stdio.h>
#include <unistd.h>
VALUE dangerous_func(...
0
votes
1
answer
140
views
Running bundle install on my Ruby on Rails application is generating errors on sqlite3 and nio4r
Running bundle install on my Ruby on Rails project was working successfully on my previous computer (macOS 11 Big Sur). However, on this new computer (macOS 14 Sonoma with the M3 Max Chip), the bundle ...
1
vote
1
answer
96
views
Compiling Ruby C API (cross-platform)
The include statements presented here corresponds to the values of RbConfig::CONFIG["rubyhdrdir"] and RbConfig::CONFIG["rubyarchhdrdir"], so I thought using RbConfig to setup the ...
0
votes
1
answer
32
views
The Ruby Fiddle Module has a bunch of constants to represent C data types (eg Fiddle::TYPE_INT == 4), but how do you represent pointer datatypes?
The Ruby doc for Fiddle only has Fiddle::TYPE_VOIDP for representing C pointer data types, but nothing for char* or int* or unsigned int*. How do you represent these data types in Fiddle?
1
vote
1
answer
52
views
How to call a method of a module properly in ruby C-api?
I am trying to write a fuzzing harness for this open source regex library , but I am running into a problem that I do not know how to call a module in the ruby C-api properly.
My current harness code ...
3
votes
1
answer
89
views
Ruby C Api handling exceptions
I am running a ruby script through C as follows:
#include <ruby.h>
int main(void) {
ruby_init();
int status;
rb_load_protect(rb_str_new2("./test.rb"), 0, &status);
if (...
0
votes
1
answer
64
views
Getting char* and size_t from C to ruby, and pass them from Ruby to C without FFI (using SWIG)
I have question because I'm out of ideas here. I have c library wrapped with SWIG. I do not use FFI because I don't want to have any 3rd party dependencies in my GEM. The thing is I faced some problem....
0
votes
0
answers
46
views
Gem seven_zip_ruby fails compiling extensions on 3.0.2 alpine based image but not on 3.0.2 debian based one
I've encountered an error but I can't figure out how to fix it.
My application uses the seven_zip_ruby gem and is based on a ruby:3.0.2-alpine image. When I try to install the gem on a Debian image, ...
0
votes
0
answers
64
views
rb_require (and other functions) not working when using Ruby C API (Windows mingw64)
After some time trying to propperly link the Ruby Library to my code, I managed how to do it, however I have this issue, whenever I want to require a file with rb_require() or to do a rb_marshal_load()...
2
votes
0
answers
87
views
Ruby crashes when embedded in a child thread
I had hoped this would have been an answer to this, but sadly, its not.
I am trying to run a single copy of ruby inside a child thread and have it communicate with the main thread.
The way the ...
3
votes
0
answers
84
views
Pause embedded ruby interpreter and resume later
I am running an embedded ruby interpreter inside a simulator.
I have wrapped the c api to the simulator so I can call it from ruby.
Unfortunately there is no blocking call to tell the simulator to run,...
-1
votes
1
answer
156
views
How to free yyptr stack in Bison?
I'm using Bison to generate a parser and the lexer is written in Ragel. When I run my code with Valgrind, it gives me this output:
200,014 bytes in 2 blocks are definitely lost in loss record 139,468 ...
1
vote
1
answer
136
views
Ruby Process.spawn significantly slows down execution of child process with big allocations
Ruby Process.spawn significantly slows down execution of child process with big allocations.
A minimal program where this occurs is the following C program compiled with -O0:
#include <stdlib.h>
...
0
votes
1
answer
72
views
Crash when trying to call ruby regex from c code
This post is a continuation of my previous post: (Call to ruby regex through C api from C code not working)
I did a few modifications and now I am calling the rb_reg_regcomp with "*".
#...