Transition to 1.9 - DL/CPtr issue

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

Try #2 to post this… hopefully no dup.

pack(“c”) is for bytes (integers). pack(“a”) is for 0-terminated
strings. Did you try pack(“a*”) ?