Compilation of ruby

Hello,

Is there any chance that ruby will become compilable by an ANSI
compiler? The problem is that I want to add some c++ constructs to the
original source for some tests and a c++ compiler does not understand
the K&R way of defining arguments to methods. This seems to be the
main stumbling block. The other stumbling block is that it implicitly
casts functions and the C++ compiler does not accept this, but this is
easily changed by adding an explicit cast.

With regards,
Christophe

My understanding is that this is *definitely* happening for 1.9/2.0,
but may or may not happen for 1.8.4.

-austin

···

On 10/3/05, Christophe Poucet <christophe.poucet@gmail.com> wrote:

Is there any chance that ruby will become compilable by an ANSI
compiler? The problem is that I want to add some c++ constructs to the
original source for some tests and a c++ compiler does not understand
the K&R way of defining arguments to methods. This seems to be the
main stumbling block. The other stumbling block is that it implicitly
casts functions and the C++ compiler does not accept this, but this is
easily changed by adding an explicit cast.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Hi,

At Mon, 3 Oct 2005 23:01:47 +0900,
Christophe Poucet wrote in [ruby-talk:158817]:

Is there any chance that ruby will become compilable by an ANSI
compiler?

Already possible. C90 doesn't prohibit K&R style function
declarations and definitions.

The problem is that I want to add some c++ constructs to the
original source for some tests and a c++ compiler does not understand
the K&R way of defining arguments to methods. This seems to be the
main stumbling block. The other stumbling block is that it implicitly
casts functions and the C++ compiler does not accept this, but this is
easily changed by adding an explicit cast.

1.9 has been protoized almost, but it's not written in C++
and not compilable as C++.

Instead, link C++ object with C-compiled ruby objects.

···

--
Nobu Nakada

I'm currently working with 1.9.0 as it seems that it has already been
partially done. There are still a lot of typing issues which I'm
fixing due to the fact that I need a version that compiles under g++.
Should I send this somewhere so that this effort is not repeated?

Christophe

Hello,

I've been making a lot of changes so that the basic ruby interpreter
will compile with C++. Mostly I used some typecasting to bypass type
problems. The brunt of the work was when rb_define_method would take
a generalized method, which I solved. There are still some issues,
however in regular expressions where I just cast to whatever type the
compiler told me (between unsigned char* and char*) though someone
should take a look into this. I've also added extern "C" { ... } to
all the .c and .h files wherever it seemed that it would not cause
problem (yet again someone will have to look into this).

The problem is that I don't want to link with C++ code. I want to
insert certain profiling templates straight into the ruby interpreter
to be able to measure certain parts of the interpreter. That is why I
needed c++ compileable code. I have not worked on the extensions, only
on the plain core and I'm getting a bug on array tests 37 and 38 which
I will look into.

Would you be interested in this work in HEAD?

Christophe

You may want to raise the question on ruby-core. Some typecasts may or
may not be appropriate; I'm not sure.

-austin

···

On 10/3/05, Christophe Poucet <christophe.poucet@gmail.com> wrote:

I'm currently working with 1.9.0 as it seems that it has already been
partially done. There are still a lot of typing issues which I'm
fixing due to the fact that I need a version that compiles under g++.
Should I send this somewhere so that this effort is not repeated?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca