2

Suppose I have a pure C library and I want to use it in Ruby or NodeJS. As far as I know, I should write a binding to the C library from my environment.

What I want to know is how this binding is possible and what the remedies are.

sawa
  • 165,429
  • 45
  • 277
  • 381
Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201
  • Have you even tried looking for this on Google: http://pravinchavan.wordpress.com/2013/11/08/c-binding-with-node-js/ – jfriend00 Feb 28 '14 at 07:24
  • possible duplicate of [How can I use a C++ library from node.js?](http://stackoverflow.com/questions/9629677/how-can-i-use-a-c-library-from-node-js) – timrau Feb 28 '14 at 07:26

1 Answers1

0

To connect to a C library from Ruby, you can use the FFI gem. It stands for Foreign Function Interface and seems to be doing what you want. There are RubyTapas series of episodes of how to use it.

lobanovadik
  • 1,018
  • 8
  • 14