Re: Porting TalkFFI / LibClang to Pharo 5 UFFI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Porting TalkFFI / LibClang to Pharo 5 UFFI

Ben Coman


On Sun, Sep 11, 2016 at 2:07 AM, Ben Coman <[hidden email]> wrote:

>
>
>
> On Sat, Sep 10, 2016 at 3:14 PM, Ben Coman <[hidden email]> wrote:
>>
>> Looks like I've been reinventing the wheel making an FFI interface to libclang.  I just bumped into Ciprian's TalkFFI which provides a NativeBoost interface to libclang (and was used to create libgit2 bindings)
>>
>> * https://rochiamaya.wordpress.com/2013/07/30/create-bindings-with-talkffi/
>> * http://smalltalkhub.com/#!/~CipT/TalkFFI
>> * http://smalltalkhub.com/#!/~CipT/LibClang
>>
>> But it is NativeBoost based and the Configuration loads AsmJit and NativeBoost packages, which seems to lock up while "Initializing Nativeboost."  What is involved in porting TalkFFI to Pharo 5.0 UFFI?
>>
>> For a start, these can be manually load no problem...
>>   LibClang-FFI-Types-CiprianTeodorov.2
>>   LibClang-Tests-CiprianTeodorov.5
>>   LibClang-Examples-CiprianTeodorov.2
>>
>> but loading LibClang-FFI-Binding-CiprianTeodorov.1
>> reports "This package depends on the following classes:
>>   CLLibraryMap
>>   CLExternalLibraryWrapper
>> You must resolve these dependencies before you will be able to load these definitions:
>>   CXIndexH"
>>
>> which I found these in TalkFFI-Runtime-CiprianTeodorov.7, but loading this
>> reports "This package depends on the following classes:
>>   NBExternalLibraryWrapper
>> You must resolve these dependencies before you will be able to load these definitions:
>>   CLExternalLibraryWrapper
>>
>> which I see is in Pharo 4.0 and not Pharo 5.0.  So what is the replacement for NBExternalLibraryWrapper?
>> What are the other general patterns for porting NativeBoost apps to UFFI?
>>
>
> For discussion I've compiled a rough comparison of classes of NativeBoost and UFFI.  Quite a bit of guesswork though.  Feel free to edit.  Probably could be slimmed by removing less significant classes like tests and OS specific classes.  
> https://docs.google.com/spreadsheets/d/1ZN6GUtzerh7KejODXNtze3njiGAryUUdSvk_U8uLZeM/edit?usp=sharing
>
> cheers -ben

I've done some additional matching and colour coding.
Btw here is how the raw data was generated...
  |classes|
  outfile := (FileStream newFileNamed: '/tmp/NB-hierarchy3') lineEndConvention: #lf.
  classes := Smalltalk allClasses select: [ :c | (c name beginsWith: 'NB') ].
  classes addAll: (classes flatCollect: [ :c | c allSuperclasses ]) asSet asOrderedCollection.
  Object printSubclassesOn: outfile level: 1 filter: classes.
  outfile close.

I needed to add printSubclassesOn:level:filter:  
as a tweak to the existing printSubclassesOn:level:filter:  
that I thought might be generally useful, so I attached it to an issue...

Extend ClassDescription>>printSubclassesOn:level: to have a filter
https://pharo.fogbugz.com/default.asp?19077

cheers -ben