Really impressive Ronie!! Alexandre
> Le 21-02-2014 à 12:50, Ronie Salgado <[email protected]> a écrit : > > Hi there!, > > It is great to hear that it is being useful. Currently I am taking some > vacations, so I will probably be without Internet access for some days. > Currently the most missing parts are documentation, which I am going to write > when having some time. > > Here are some early details, before I start properly documenting them: > ·This is heavily based in the C# bindings. There are additional typemaps such > as nbtype, nbin and nbout. They are similar to the cstype, csin and csout > typemaps presents the C# generator. > ·They are two Smalltalk class and some common superclasses generated. One > Smalltalk class contains all the NB-FFI callout methods, another contains > wrappers for all the global C/C++ stuff. > ·For each C++ a Smalltalk class is generated. > ·The common superclass provides a destroy method for destroying an object. > ·The extra overhead in new are to register properly with the GC. > ·The C pointer is wrapped in a reference object that contains things for > properly interact with the GC and destroying C++ object avoiding crashing the > VM. > > Swig usually makes some kind of opaque type for some pointers. If they are > intended to be an Array, maybe some extra typemaps has to be added. More > information about typemaps is on the SWIG manual. > > I took that kind of approach because it gives more flexibility, but it > provides probably a reduced performance in comparison with placing the > callouts directly in the wrapped classes. Some people that saw this when > developing this did not like this approach. > > I will document all of this more properly later, but I have to go now because > I am in a hurry. > > Best regards, > Ronie Salgado > > > 2014-02-21 7:16 GMT-03:00 [email protected] <[email protected]>: >> Excellent!!!! >> >> That's really a missing block coming to life! >> >> I'll try it this weekend on my Linux system. >> >> Phil >> >> >> >>> On Fri, Feb 21, 2014 at 10:24 AM, Göran Krampe <[email protected]> wrote: >>> Hi all! >>> >>>> On 01/22/2014 09:25 PM, Ronie Salgado wrote: >>>> I started working on extending SWIG to generate bindings for NativeBoost >>>> FFI, using as a reference the C# binding generator. I am committing my >>>> work on this into https://github.com/ronsaldo/swig/ . >>> >>> Just wanted to report that this stuff WORKS :) >>> >>> * I cloned down Ronie's SWIG. Did the autogen.sh, ./configure, make, make >>> install dance. >>> * I went into Examples/ruby/value and: >>> * Changed module name to "Example" (instead of "example") >>> * Ran: swig -pharo example.i (produces C code and Example.st) >>> * Compile: gcc -m32 -c -fpic -fPIC example_wrap.c example.c >>> * Link: gcc -m32 -shared example.o example_wrap.o -o Example.so >>> * Then I filed in Example.st into Pharo 2.0, and put Example.so in the >>> directory where I started the pharo VM. >>> >>> And well, after fixing some buglets (if you want to recreate this, email me >>> or ask here) it works! I added a little test class for fun. >>> >>> Fantastic stuff! Sure, not complete by any means, but hey, it worked and >>> not a single VM crash while playing with it. Ronie - good work! >>> >>> If you are on a Linux, I attached these two files. File into Pharo 2.0, >>> open TestRunner and run ExampleTest. >>> >>> regards, Göran >
