From fourmond at gmail.com Sun Jul 26 15:43:03 2009 From: fourmond at gmail.com (Vincent Fourmond) Date: Sun, 26 Jul 2009 21:43:03 +0200 Subject: [Tioga-users] [Fwd: Re: Creating DVolume object based on DTable code] Message-ID: <4A6CB1C7.5050502@gmail.com> Sorry, I forgot to post to the mailing list... -------- Original Message -------- Subject: Re: [Tioga-users] Creating DVolume object based on DTable code Date: Sun, 26 Jul 2009 21:19:32 +0200 From: Vincent Fourmond To: Benjamin ter Kuile References: <6680778a0907260937u108fd33k9317499a74789f4a at mail.gmail.com> Hello, Here is a quick answer to both... I'm in a rush ;-)... Benjamin ter Kuile wrote: > I have actually two questions, I tried if there would be a fast way to > make Tioga ruby 1.9 compatible, but failed because my experience with > extension modules is close to none. ?? What fails ? I've just checked again, and it seems to compile fine with ruby1.9. I haven't tried to install/check yet, but I remember working on Tioga to make it 1.9-compatible --- and succeeding. > But since 1.8 still works fine, > there is no big priority in this one. Another thing is that I started > creating a Dvolume extension based on the Dtable and Dvector codes that > works in 3D. I do this as a separate module outside of Tioga. I already > have a 3D array, but I am not able to make use of Dtables and Dvectors > passed as arguments to functions of the Dvolume. Getting something as > Dvector_Data_for_Read as is now in the code would already be something, > of course with the addition of Dtable_Data_for_Read as well. Is somebody > interested to give me some help on this one? I would be really thankful. This was my nightmare, when I split Dvector, Dtable and Flate out of Tioga. The game is the following: * you need to get the symbols.{h,c} and namespace.h files from the split/ directory and add them to your source code. * include them with something like: #include "symbols.h" #include "symbols.c" (in the .c file) (yes, you need to include the .c one too, for painful reasons) * include the header files found in split/{Dtable,Dvector}/include, that provide the definitions for the functions you need * import the functions using a code in the spirit of: /* now we import the symbols from Dvector */ VALUE cDvector = rb_const_get(mDobjects, rb_intern("Dvector")); RB_IMPORT_SYMBOL(cDvector, Dvector_Create); RB_IMPORT_SYMBOL(cDvector, Dvector_Data_Resize); RB_IMPORT_SYMBOL(cDvector, Dvector_Data_Replace); RB_IMPORT_SYMBOL(cDvector, Dvector_Data_for_Read); RB_IMPORT_SYMBOL(cDvector, Dvector_Store_Double); ( this should be in your Init_Class() function). This code comes from split/dtable.c. I hope this will be enough to get you going. BTW, I've given quite a lot of thoughts about this process, and it is the only one (short of making proper shared libraries) that gives results that are portable on Linux, MacOS and Cygwin (so windows, because the dynamic linker is the one from windows, from what I remember). Cheers, Vincent -- find(1): A `%' at the end of the format argument causes undefined behaviour since there is no following character. In some locales, it may hide your door keys, while in others it may remove the final page from the novel you are reading. Vincent, listening to Prologue (Loreena McKennitt)