[#863] RDtool-0.5.0 — Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>

Hi,

18 messages 1999/10/23
[#864] Re: RDtool-0.5.0 — matz@... (Yukihiro Matsumoto) 1999/10/26

Hi,

[ruby-talk:00842] Ruby as an extension language ?

From: Clemens Hintze <c.hintze@...>
Date: 1999-10-03 14:07:55 UTC
List: ruby-talk #842
Artur Matos writes:
> 	Hi,

Hi,

> 
> 	I'm looking for an extension language (aka a macro language) for
> a large program i'm developing.  After seeing some alternatives, I think
> Ruby could make a nice extension language for my program. 

good choice! :-) But may I first welcome you here? :-)))

> 
> 	The problem is I don't find specific information for using
> Ruby this way, only as a standalone scripting language. Is
> it possible to use Ruby as an extension language ? If it is, I would like
> to know how : 

It is all possible yet! I am writing a tutorial about that matter
right now, but currently it stops a little bit, as I am very busy with 
work for my employer :-( So until I have time to finish my tutorial,
you have to stick with the file `README.EXT' which comes with the
standard distribution of Ruby! It is a very good starting point.

And if there are things you don't understand, please feel free to ask
on the list! Many people will be happy to answer you :-)))

Believe me! It is most easier to use C and Ruby together than C with C 
itself ;-))))

> 
> 	- to embeb the ruby interpreter in my program.

That is no problem at all!

> 	- to interface ruby with C/C++ calls. (specialy
> C++, as my program is written in C++)

Here is a problem. IMHO, Ruby is only able to deal with C
functions. Ruby cannot simply use C++ classes, methods of even
functions! You would have to wrap these functions with an

	   extern "C" {...}

to use them. But of course, then you would not be able to use C++
overloading or the like!

Perhaps you have to specify a little bit more, what you want to
do. Then we could tell you, whether it is possible or not!

> 
> 	Thanks.

You're welcome!

> 
> 	Artur Matos (ei96024@fe.up.pt)
> 
> 

\cle

In This Thread