Communication between different C extensions

Discussion in 'Ruby' started by Vincent Fourmond, Jan 28, 2007.

  1. Hello !

    A long time ago, I was bitten hard by interoperability between
    different C extensions that need to access each others internals. As at
    that moment I was controlling the source code of all extensions, I got
    away with a (simple ?) workaround.

    Now is time for me to get bitten again. I'm currently writing a Ruby
    wrapper for a C++ library providing simple symbolic calculus (and
    evaluation). The extensions provides functions to apply a formula to a
    great number of numbers, a bit like the following:

    apply("x + y", 'x' => [1,2], 'y' => [3,4])
    => [4,6]

    I want to be able to interface that with the common libraries for
    manipulating data (Narray, ruby-gsl and Dobjects, a library used by
    Tioga). However, I'm not aware of any way to do this 'cleanly'. Sure, I
    can hack the data structures from the headers of these extensions, but
    that means breaking binary compatibility everytime a header changes -
    not very much something I like.

    Is there a better way to do so ? Going through Ruby arrays isn't an
    option for speed issues (very expensive to convert a double * to a VALUE
    array and back to double *...). Any ideas ?

    Thanks,

    Vince

    --
    Vincent Fourmond, PhD student (not for long anymore)
    http://vincent.fourmond.neuf.fr/
     
    Vincent Fourmond, Jan 28, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    0
    Views:
    313
  2. Replies:
    1
    Views:
    1,303
    Chris Uppal
    Jan 5, 2005
  3. nishadixit
    Replies:
    0
    Views:
    416
    nishadixit
    May 24, 2005
  4. takaya
    Replies:
    2
    Views:
    1,013
    Thomas Hawtin
    Jan 18, 2006
  5. Marco
    Replies:
    0
    Views:
    261
    Marco
    Apr 6, 2007
Loading...

Share This Page