Joe Van Dyk
4/8/2005 11:57:00 PM
Hi,
I have a program in C that is a part of a very complex system. When
the C program is launched, it has access (through shared memory) to a
whole bunch of other information. To communicate via shared memory is
a very complicated process, so, it can only realistically be done in C
(or Ada).
I'd like to access some of the shared memory data in Ruby. I'm
currently doing it through message queues between the Ruby program and
the C program. The C program has a function that's called forty times
a second. In that C function, I check a message queue to see if
there's any messages. If there's a message, I then do a certain
action, based on what the message is. If I need to return data from
the C program to the Ruby program, I add the data to the message queue
from C and then the Ruby program then can access the data.
It's a pretty cumbersome method, as every time I want to access some
different data in Ruby, I gotta update the C program to get and parse
the new request message, get the data from shared memory and return
the new data via message queues to the Ruby program. But it was the
best I could come up with.
Anyone got an idea of how I can improve this?
Thanks,
Joe