On 1/11/07, Nathaniel Trellice <naptrel / yahoo.co.uk> wrote:
> Hello,
>
> I'm new to ruby, but fairly experienced in C. I am using Ruby on Rails
> to chat to a postgres database. I have some C functions that I can run
> in the database backend. I would like to use constants defined in C
> header files, e.g "#define MY_CONSTANT 100" within ruby code. I know I
> can similarly define a constant in ruby, i.e. "MY_CONSTANT=100", but
> given that I have quite a few of these, and synchronising the two files
> could become tricky, is there some (preferably simple) clever way/hack
> that I can define constants in a single file and use them both in C and
> in Ruby?
>

I don't see how you'd share C preprocessor constants between Ruby and
C, since they're not available at runtime, unless you run the C
preprocessor on both Ruby and C files (oh, the horror).

> Thanks,
> Nat
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


-- 
- Simen