[Pharo-dev] UnifiedFFI Docs
nicolas.cellier.aka.nice at gmail.com
Wed Oct 18 16:21:23 EDT 2017
2017-10-18 19:05 GMT+02:00 Todd Blanchard <tblanchard at mac.com>:
> I'm working through Ben's great blog post about playing with libclang and
> I am puzzled by something.
> handle atAllPut: 0.
> zero;s out the handle. Cool. However,
> handle isNull
> does not return true despite it being used in the getString method as
> ^ handle isNull
> ifTrue: ['external memory invalidated by session restart']
> ifFalse:[LibClang clang_getCString__cxString: self].
> Looks like there should be an isNull on ByteArray that returns true if all
> bytes are zero but it isn't there. Was it dropped for some reason?
In original FFI, a ByteArray could not represent a pointer, so it answered:
"Answer false since only external addresses can be null"
There was an ExternalAddress subclass for this purpose where isNull was
"Answer true if I am a null pointer"
1 to: self size do:[:i| (self at: i) = 0 ifFalse:[^false]].
and there was also a #beNull to nullify the address...
What happens now with UnifiedFFI, is the old FFI API supported (and thus
the example correct), what about Alien, are questions that you must
inquire, but once upon a time, it worked.
Should isNull be defined as you suggest in ByteArray? If the semantic is
#isNullPointer, then I don't think so. If it's a more general message, then
What is the class of handle?
> On Oct 18, 2017, at 2:58 AM, Dimitris Chloupis <kilon.alios at gmail.com>
> Sure the documentation could be better, that is definetly important, but
> is already good enough and UFFI is a very technical subject much more
> suited to a mailing list . Its not physical possible to cover the massive
> potential of UFFI.
> On Wed, Oct 18, 2017 at 9:32 AM Stephane Ducasse <stepharo.self at gmail.com>
>> Please do not hesitate to do Pull Requests.
>> Luc told me that he wants to do a pass on it and Esteban promises that to
>> but he is super busy.
>> On Wed, Oct 18, 2017 at 5:54 AM, Todd Blanchard <tblanchard at mac.com>
>> > Wonderful! Thanks.
>> >> On Oct 17, 2017, at 3:45 PM, stephan <stephan at stack.nl> wrote:
>> >> On 17-10-17 23:06, Todd Blanchard wrote:
>> >>> Anyone know what happened to this?
>> >>> https://ci.inria.fr/pharo-contribution/view/Books/job/
>> >> https://github.com/SquareBracketAssociates/Booklet-uFFI
>> >> has a link to a bintray pdf download
>> >> Stephan
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev