Transition to 1.9 - DL/CPtr issue

Discussion in 'Ruby' started by wamrewam, Jun 17, 2012.

  1. wamrewam

    wamrewam Guest

    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:
    would work but it does not (segmentation fault).

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

    wamrewam, Jun 17, 2012
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.