Re: [Pharo-users] UFFI correct way to cast void*

2018-02-17 Thread Ben Coman
On 18 February 2018 at 01:46, Esteban Lorenzano wrote: > > > On 17 Feb 2018, at 02:50, Ben Coman wrote: > > > > On 16 February 2018 at 16:38, Esteban Lorenzano > wrote: > >> hi, >> >> “casting” is not necessary in general since is

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-17 Thread Egor Scorik
Thanks! #valueFromHandle: exactly what I looking for! I also add method for strings to make them working FFIExternalString >> valueFromHandle: anAddress | data | data := ExternalData fromHandle: anAddress type: ExternalType string. data

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-17 Thread Esteban Lorenzano
> On 17 Feb 2018, at 02:50, Ben Coman wrote: > > > > On 16 February 2018 at 16:38, Esteban Lorenzano > wrote: > hi, > > “casting” is not necessary in general since is just a way to tell the C > compiler that a

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-16 Thread Stephane Ducasse
Hi esteban do you plan to add this explanation to the documentation of uFFI? Stef On Fri, Feb 16, 2018 at 9:38 AM, Esteban Lorenzano wrote: > hi, > > “casting” is not necessary in general since is just a way to tell the C > compiler that a pointer is form a certain type

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-16 Thread Stephane Ducasse
On Fri, Feb 16, 2018 at 9:07 AM, Torsten Bergmann wrote: >>but unfortunately its hard to find any docs or examples. > > PDF Docu: https://github.com/SquareBracketAssociates/Booklet-uFFI > >(this should be added to http://books.pharo.org) It will be added when it will

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-16 Thread Ben Coman
On 16 February 2018 at 16:38, Esteban Lorenzano wrote: > hi, > > “casting” is not necessary in general since is just a way to tell the C > compiler that a pointer is form a certain type (but is always a pointer, > and in machine code is always the same). > > So, here you

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-16 Thread Esteban Lorenzano
hi, “casting” is not necessary in general since is just a way to tell the C compiler that a pointer is form a certain type (but is always a pointer, and in machine code is always the same). So, here you will do something like this: Iterator >> asCollectionOfType: aTypeName | result

Re: [Pharo-users] UFFI correct way to cast void*

2018-02-16 Thread Torsten Bergmann
>but unfortunately its hard to find any docs or examples. PDF Docu: https://github.com/SquareBracketAssociates/Booklet-uFFI (this should be added to http://books.pharo.org) Examples: load OSWindows, OSLinuxUbuntu, ... or GlorpSQlite from catalog They all use UFFI.

[Pharo-users] UFFI correct way to cast void*

2018-02-15 Thread Egor Scorik
Hi, I'm trying to play with new UFFI system. It looks much easier then NativeBoost, but unfortunately its hard to find any docs or examples. I have problem with casting void* (ExternalAddress) into smalltalk object if there is no hardcoded type in ffi method. And I really dislike the idea of