[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

using ruby in place of C

Chris Finch

1/15/2007 11:43:00 AM

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.

--
Posted via http://www.ruby-....

3 Answers

Dido Sevilla

1/15/2007 11:50:00 AM

0

On 1/15/07, Chris Finch <christopher.finch@nuth.nhs.uk> wrote:
> 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.

Bira

1/15/2007 11:57:00 AM

0

On 1/15/07, Chris Finch <christopher.finch@nuth.nhs.uk> wrote:
> 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.



--
Bira
http://compexplicita.bl...
http://sinfoniaferida.bl...

Marc Heiler

1/15/2007 3:26:00 PM

0

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 :)

--
Posted via http://www.ruby-....