using ruby in place of C

C

Chris Finch

Hi all,
This may be silly question but:

There is a program that I want to use that says:
"there is a C interface provided so that user codes can be written in C
or C++."

What I want to know is if I can write these "user codes" in ruby
instead?

Chris.
 
D

Dido Sevilla

Hi all,
This may be silly question but:

There is a program that I want to use that says:
"there is a C interface provided so that user codes can be written in C
or C++."

What I want to know is if I can write these "user codes" in ruby
instead?

But you will have to work at writing a Ruby extension in C that uses
the published C interface first. If you intend to use the program from
Ruby a lot, it will make a lot of sense to do so.
 
B

Bira

Hi all,
This may be silly question but:

There is a program that I want to use that says:
"there is a C interface provided so that user codes can be written in C
or C++."

What I want to know is if I can write these "user codes" in ruby
instead?

You can. There's a program called SWIG that can "wrap" a C interface
so that it can be called from Ruby. You would have to do that first,
but then you could use this interface as if it were any other Ruby
library.
 
M

Marc Heiler

What are "user codes"?

Anyway, if you can EXTEND it in C, you can use Ruby-C as well as
easily, and afterwards use pure Ruby. Not sure if that will
work in your case, I dont know what "user codes" are :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,140
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top