Transition to 1.9 - DL/CPtr issue

W

wamrewam

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top