Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Transition to 1.9 - DL/CPtr issue

10 views
Skip to first unread message

wamr...@googlemail.com

unread,
Jun 17, 2012, 12:51:23 PM6/17/12
to
Hi guys,

I am trying to transition an app to Ruby 1.9 from 1.8.7. This app is calling a shared lib (.so) and it does not work (at all) anymore with the new Ruby.
The reason is there is no more to_ptr with DL in 1.9, but I am struggling to replace it. For instance I had:

extern "bool mclInitializeApplication_proxy(const char**, size_t)"

and in Ruby:

options = ["-nojvm"]
mclInitializeApplication_proxy(options.to_ptr, options.length)

In the Ruby std doc, there is an example:

extern 'double sum(double*, int)'
a = [2.0, 3.0, 4.0]
sum = LibSum.sum(a.pack("d*"), a.count)

so I thought:
CPtr.to_ptr(options.pack("c*")).ptr
would work but it does not (segmentation fault).

Any help would be greatly appreciated, documentation on the new DL is quite limited...

Thanks!
PJ
0 new messages