Questions tagged [ruby-ffi]

Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code.

Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code. It works without changes on Ruby and JRuby.

31 questions
1
vote
1 answer

How do I change icon positions via FFI?

I'm trying to change the positions of icons in a Windows 7 Desktop using Ruby with the FFI gem. So far "Managing Desktop Icons" has most of what I want but it's not working for me. The article uses LVA_ALIGNLEFT at one point but I understand I…
Lifeweaver
  • 986
  • 8
  • 29
0
votes
1 answer

Ruby Fiddle - Cannot find function in WIndows MSYS2

I am trying to use Ruby Fiddle to access a C function I have developed. The C code is: #include #include #include double *linalg_positive_matrix(double *mat_a, int rows_a, int cols_a); int main(void) { } double…
Rojj
  • 1,170
  • 1
  • 12
  • 32
0
votes
1 answer

Ruby Fiddle - Reload dynamic library

I am using Fiddle to load a function from a dynamic library written in C. During development I need to make changes to the library and reload it for testing. The problem is that dlload does not reload the library unless I relaunch the script. I am…
Rojj
  • 1,170
  • 1
  • 12
  • 32
0
votes
1 answer

Define a initialize method for a Ruby FFI::Struct?

Currently, I have a RUby FFI Struct: class Color < FFI::Struct layout :red, :uchar, :green, :uchar, :blue, :uchar end Which needs to be created like t his: color = Color.new color[:red] = 255 color[:green] = 0 color[:blue] = 0 Can I define an…
Amreus
  • 1
  • 1
0
votes
1 answer

How do I identify why Ruby-FFI and VB.net can't load a dll file?

I have a file that has four functions I need to use. The DLL function documentation is here. I have tried loading the DLL with both Lib in VB.net and ffi_lib with Ruby-FFI. Both give me errors loading the DLL, but nothing I have been able to use to…
Brandon
  • 1,735
  • 2
  • 22
  • 37
0
votes
1 answer

Ruby/FFI: String not getting to *char function argument

I'm trying to implement with FFI a few functions from the Darknet library: require 'ffi' class Image < FFI::Struct layout :w, :int layout :h, :int layout :c, :int layout :data, :pointer end class Darknet extend FFI::Library ffi_lib…
0
votes
1 answer

Stop a c function with infinite loop from ruby using RubyFFI

Following is my scenario, I call a c function called 'subscribe' from Ruby using Ruby FFI The sub function runs infinitely in a while loop I need a way to stop this subscription from Ruby (Need to stop the c function which runs…
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
0
votes
1 answer

Ruby FFI loading - OSX

I'm wondering if someone can assist with the issue that has been opened here: https://github.com/technion/ruby-argon2/issues/1 Specifically, I have released a gem, and I've received advise a user is experiencing an issue. That being the following…
technion
  • 39
  • 8
0
votes
1 answer

Differences between ruby ffi module and the fiddle module

Except the fact that Fiddle is a module from the standard library of ruby and that ruby-ffi is an external module, what are the main differences between them. More specificaly, what could be the reasons that lead you to use one over the other?…
cedlemo
  • 3,205
  • 3
  • 32
  • 50
0
votes
1 answer

How to package a library and ffi-interface as gem? Possible?

I created a library for a project I was working on. Essentially, it packages imgSeek as an alternative to pHash/phashion. See this link for…
user3113723
  • 169
  • 13
0
votes
1 answer

How do you attach a C function that returns a string using ruby ffi?

I am currently working on a C string metric library and am writing bindings for ruby. Using ffi how can I attach a function with a signature like char *function(const char *, const char *)? The function in question will allocate a string on the heap…
Rostepher
  • 201
  • 2
  • 8
0
votes
1 answer

Watching for an error message in rspec that isn't an exception

I'm writing a Ruby API for a C API which encapsulates a C++ library. The C API catches C++ exceptions thrown by the C++ library. Ideally, I could go in and modify my C library so it raises Ruby exceptions, but since I'm using FFI, that's not really…
Translunar
  • 3,739
  • 33
  • 55
0
votes
1 answer

How do I get AJAX working using rails and a javascript timer?

The rails application that I am programming takes in data from an external source from a shared object via ruby's ffi gem. I have got the data to come in and display on the screen once but when i try to update with AJAX I cant seem to manipulate the…
0
votes
0 answers

Why does bundler influence the execution of a native C++ library

I have written a Ruby gem that makes use of the most recent version of FFI to access a (as well self written) shared object library. I am using ruby 2.0.0p247 in conjunction with rvm 1.21.12. My gem includes an 'executable' in /bin thats works as…
GeorgieF
  • 2,687
  • 5
  • 29
  • 43
0
votes
1 answer

How to use a C++ singleton to return an object initialized only once

I am a real C++ noob, so please be patient with me. First lets set the stage. I have a C++ source in binary.cpp that compiles to a binary which looks like: # include "lotsofheaders.h" int main(int argc, char* argv[]) { int errorcode =…
GeorgieF
  • 2,687
  • 5
  • 29
  • 43