Is Ruby has something equivalent to ctypes in Python?

I would like to load dll and create complex c datatype structure for the
dll. This can be done with ctypes library in Python.
So, do ruby has similar library like ctypes?

Shin guey Wong wrote:

I would like to load dll and create complex c datatype structure for the
dll. This can be done with ctypes library in Python.
So, do ruby has similar library like ctypes?

On Rubinius and JRuby, you can use FFI. I’m hoping someone can do an FFI
port for MRI so everyone can start using the same library.

Here’s a couple articles on FFI. JRuby and Rubinius support roughly the
same API, though it’s probably going to see one or two more changes
before we release it in JRuby 1.1.4.

http://pluskid.lifegoo.com/?p=370#ffi-doc

http://wiki.jruby.org/wiki/Calling_C_from_JRuby

There also exists the “dl” library on Ruby, but most people I’ve talked
to consider it to be a bit too buggy/leaky for use. I don’t know if
that’s true.

  • Charlie

Charles Oliver N. wrote:

On Rubinius and JRuby, you can use FFI. I’m hoping someone can do an FFI
port for MRI so everyone can start using the same library.

  • Charlie

Is the FFI for Rubinius and JRuby compatible? It would be great is all 3
ruby implementation using the same library.

Ruby/DLhttp://ttsky.net/ruby/ruby-dl.html

Doc is a bit scarce, I’ve had better luck reading source, but it
generally
does the job.

Shin guey Wong wrote:

Charles Oliver N. wrote:

On Rubinius and JRuby, you can use FFI. I’m hoping someone can do an FFI
port for MRI so everyone can start using the same library.

  • Charlie

Is the FFI for Rubinius and JRuby compatible? It would be great is all 3
ruby implementation using the same library.

It is compatible between JRuby and Rubinius, and will be in a production
release of JRuby this month (1.1.4). We’re looking for help getting an
FFI for the C Ruby implementations as well so everyone can use the same
library.

  • Charlie

On Rubinius and JRuby, you can use FFI. I’m hoping someone can do an FFI
port for MRI so everyone can start using the same library.

In the meanwhile you could try http://www.dyncall.org/. Seems pretty
functional, could it even be the basis for a MRI FFI?

Greets

Until a uniform solution is done, you can give a try to
http://www.dyncall.org/, it has ruby bindings.

Greets!

On Thu, Aug 14, 2008 at 7:02 PM, Charles Oliver N.
[email protected] wrote:

ruby implementation using the same library.

It is compatible between JRuby and Rubinius, and will be in a production
release of JRuby this month (1.1.4). We’re looking for help getting an FFI
for the C Ruby implementations as well so everyone can use the same library.

  • Charlie


Emmanuel O.
ELC Technologies ™
1921 State Street
Santa Barbara, CA 93101
[email protected]

(866)863-7365 Tel
(866)893-1902 Fax

+44 (0) 20 7504 1346 Tel - London Office
+44 (0) 20 7504 1347 Fax - London Office

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs