From: Saji Hameed Date: 2012-11-14T03:11:17+09:00 Subject: Re: Calling Ruby from C (reverse SWIG) --047d7b67886409673604ce64587d Content-Type: text/plain; charset=UTF-8 If I am not mistaken, the subtle window manager embeds ruby within its C code. http://subforge.org/projects/subtle/repository On Wed, Nov 14, 2012 at 2:37 AM, Reid Thompson wrote: > On Tue, 2012-11-13 at 09:43 +0900, Graham Menhennitt wrote: > > My C program calls a third-party Windows DLL to provide access to some > specialised hardware. I don't have source code for this DLL. We're losing > access to the hardware soon but we want to be able to test our software via > an emulator. I'd like to write the emulator in Ruby. > > > > So I need a simple way to call Ruby from C - a bit like a reverse SWIG. > I can do it using an RPC mechanism to a separate process, but I was > wondering if anybody knew of a simpler way. Something where a Ruby library > ran in the same process as the C code would be ideal. > > > > Any ideas please? > > > > Thanks, > > Graham. > > http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html scroll > down to > > Embedding a Ruby Interpreter > > or google > embedding ruby in C > for other examples > > > > -- Saji N Hameed, ARC-ENV, Center for Advanced Information Science and Technology, University of Aizu, Tsuruga, Ikki-machi, Aizuwakamatsu-shi, Fukushima 965-8580, Japan Tel: +81242 37-2736 Fax:+81242 37-2760 email: saji@u-aizu.ac.jp url: http://www.u-aizu.ac.jp bib: http://www.researcherid.com/rid/B-9188-2009 --047d7b67886409673604ce64587d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable If I am not mistaken, the subtle window manager embeds ruby within its C co= de.
http://su= bforge.org/projects/subtle/repository

On Wed, Nov 14, 2012 at 2:37 AM, Reid Thomps= on <Reid.Thompson@ateb.com> wrote:
On Tue, 2012-11-13 at 09:43 +0900, = Graham Menhennitt wrote:
> My C program calls a third-party Windows DLL to provide access to some= specialised hardware. I don't have source code for this DLL. We're= losing access to the hardware soon but we want to be able to test our soft= ware via an emulator. I'd like to write the emulator in Ruby.
>
> So I need a simple way to call Ruby from C - a bit like a reverse SWIG= . I can do it using an RPC mechanism to a separate process, but I was wonde= ring if anybody knew of a simpler way. Something where a Ruby library ran i= n the same process as the C code would be ideal.
>
> Any ideas please?
>
> Thanks,
> =C2=A0 =C2=A0Graham.

http://www.ruby-doc.org/docs/ProgrammingRuby= /html/ext_ruby.html scroll down to

Embedding a Ruby Interpreter

or google
embedding ruby in C
for other examples






--

Saji N Hameed,
A= RC-ENV, Center for Advanced Information Science and Technology,
Universi= ty of Aizu, Tsuruga, Ikki-machi,
Aizuwakamatsu-shi, Fukushima 965-8580,<= br> Japan
=C2=A0 =C2=A0 =C2=A0 =C2=A0
Tel: +81242 37-2736
Fax:+81242 = 37-2760
=C2=A0email: saji@u-aizu.ac.jp
=C2=A0url: http://www.u-aizu.ac.jp
=C2=A0bib: http://www.researcherid.com/rid/B-9188-2009
--047d7b67886409673604ce64587d--