Subject:
Re: [ruby-ffi] c++ examples
From:
Hongli Lai
Date:
12/1/09 5:21 PM
To:
ruby-ffi

On Wed, Dec 2, 2009 at 12:02 AM, Luis Lavena <luislavena@gmail.com> wrote:
> On Tue, Dec 1, 2009 at 7:38 PM, rogerdpack <rogerdpack@gmail.com> wrote:
>> Are there any c++ examples anywhere?
>
> libffi aims to be C interface.
>
> I'm unaware of libffi being compatible with C++, so I would recommend
> something like Rice to provide an interface on top of it.
>
> http://rice.rubyforge.org/
>
>> My end goal is to be able to use Boost's hashes/regexes.
>
> Been looking into building boost sockets and other threading
> functionalities, but definitely you need a PhD to look into Boost
> itself, which I'm not capable of digest.

Unlike C, C++ does not have a stable ABI, so supporting C++ in FFI
would be a huge undertaking (i.e. supporting the bazzilion of
different ABIs in existance so far). I think your best bet right now
is to write C wrappers around the Boost stuff and then use FFI to talk
to the C wrappers.

-- Phusion | The Computer Science Company Web: http://www.phusion.nl/ E-mail: info@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)