ruby-c-extension Questions
3
Solved
I am developing a gem, which is currently pure Ruby, but I have also been developing a faster C variant for one of the features. The feature is usable, but sometimes slow, in pure Ruby. The slownes...
Nucleolated asked 1/7, 2013 at 13:57
4
Solved
I came across this code.
typedef __mpz_struct MP_INT;
typedef __mpz_struct mpz_t[1];
Here the struct __mpz_struct is a struct that is typedefed to an array of single element. I understand that t...
Dekaliter asked 27/5, 2015 at 9:57
2
Solved
I'd like to organize the C source code like this:
+ /
|
|___ + ext
| |
| |___ + native_extension
| |
| |___ + lib
| | |
| | |___ (Source files are kept in here - may contain sub-folders)
| |
| |__...
Erick asked 8/10, 2011 at 16:29
2
I am looking for a function which can get me all the keys from hash or I can loop through the hash to retrieve single key at a time.
Currently I am hardcoding key
VALUE option = rb_hash_aref(op...
Brittaniebrittany asked 10/12, 2014 at 16:15
1
Solved
How does one handle Ruby 2.0.0 keyword arguments from a C extension?
Background
def example(name: 'Bob' hat_color: 'red')
puts "#{name} has a #{hat_color} hat!"
end
example #=> "Bob has a re...
Omni asked 20/12, 2013 at 19:11
2
Solved
I'm trying to write a C extension to ruby that'll generate a class. I'm looking on how to define some default arguments to a class. For example, if I have this class decleration in ruby:
class MyC...
Plunder asked 2/10, 2011 at 13:52
1
Solved
I want to call ruby code from my own C code. In case an exception gets raised, I have to rb_protect the ruby code I call. rb_protect looks like this:
VALUE rb_protect(VALUE (* proc) (VALUE), VALUE...
Ales asked 18/6, 2012 at 15:56
4
I've recently updated to Mountain Lion and re-installed Ruby, but when I try to run a test Rails app, I get an error message that says that "Rails is not currently installed" on my system. I do wha...
Protanopia asked 3/8, 2012 at 20:35
2
I am working on a C extension for ruby, but I need to include headers from the IOBluetooth framework, specifically:
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
#import <IOBlueto...
Cynicism asked 14/10, 2012 at 23:45
1
Solved
I am trying to build a Ruby C Extensions that uses libcurl. So far I have built it sucessfully on Os X. However I am much less experienced developing in Windows and am not exactly sure how to go ab...
Panhandle asked 14/7, 2012 at 2:1
1
Solved
I have problems creating a ruby extension to export a C++ library I wrote to ruby under OSX. This simple example:
#include <boost/regex.hpp>
extern "C" void Init_bayeux()
{
boost::regex e...
Hyperboloid asked 27/6, 2012 at 10:25
1
I'm currently experimenting with creating my own gem in Ruby. The gem requires some static resources (say an icon in ICO format). Where do I put such resources within my gem directory tree and how ...
Gunthar asked 15/6, 2012 at 13:44
2
Solved
I'm writing a gem, that includes a C extension. Usually when I write a gem, I follow a process of TDD, where I'll write a failing spec and then work on the code until it passes, etc etc...
With my...
Roccoroch asked 30/3, 2012 at 14:4
1
Solved
Im writing a Ruby extension and Im using the function Data_wrap_struct.
In order to participate in Ruby's mark-and-sweep garbage collection process, I need to define a routine to free my structure...
Fussell asked 6/12, 2011 at 11:7
1
Solved
I'm writing a Ruby 1.9 C extension and I want to do the following in ruby:
notifier = Notifier.new
notifier.on 'click' do
puts "clicked!"
end
Now the problem with this is that on the C method, ...
Eslinger asked 17/1, 2012 at 22:57
2
Solved
So, recently I had the unfortunate need to make a C extension for Ruby (because of performance). Since I was having problems with understanding VALUE (and still do), so I looked into the Ruby sourc...
Conveyor asked 13/8, 2011 at 13:49
1
Solved
I want to return several values from a C function, and IMHO, a hash is a good option.
I first used rb_intern('A_KEY') to create the keys, but the extension crashed. Now, I am using rb_str_new2, but...
Bonita asked 24/12, 2010 at 15:37
1
Solved
I'm writing a C extension, providing an interface between Ruby and an asynchronous I/O library. When running the tests over my code, I frequently get errors including (but not limited to):
[BUG] c...
Infinitesimal asked 20/9, 2010 at 13:39
1
Solved
In ruby,
begin
# ...
rescue
# ...
end
won't catch exceptions that aren't subclasses of StandardError. In C,
rb_rescue(x, Qnil, y, Qnil);
VALUE x(void) { /* ... */ return Qnil; }
VALUE y(void...
Interpret asked 9/7, 2010 at 21:48
1
Solved
I'm writing a ruby extension that defines a class.
If I use Data_Wrap_Struct() to implement my callback for rb_define_alloc_func(), do I need to manually mark and free the instance variables? Or is...
Undercoating asked 9/6, 2009 at 14:52
1
© 2022 - 2024 — McMap. All rights reserved.