welcome
Subject: [Pharo-users] Re: uFFI provide buffer to C
Hi Gerry,
I think the point of Tomaz is that an FFI method can only have a single
#ffiCall: statement.
In your example, what you can do is to split your method in two methods:
First a method with the mapping (following the idea of Tomaz
;
>> El 29 nov 2021, a las 0:56, Gerry Weaver escribió:
>>
>> Hi,
>>
>> Thanks for the example. Unfortunately, it doesn't work on Linux.
>>
>> Thanks,
>> Gerry
>>
>>
>> From: Tomaž Turk
>> Sent: Sunday, Novemb
work on Linux.
>
> Thanks,
> Gerry
>
>
> From: Tomaž Turk
> Sent: Sunday, November 28, 2021 11:39 AM
> To: Any question about pharo is welcome
> Subject: [Pharo-users] Re: uFFI provide buffer to C
>
> Hi,
>
> try with this:
>
> FFITutorial>&g
Hi,
Thanks for the example. Unfortunately, it doesn't work on Linux.
Thanks,
Gerry
From: Tomaž Turk
Sent: Sunday, November 28, 2021 11:39 AM
To: Any question about pharo is welcome
Subject: [Pharo-users] Re: uFFI provide buffer to C
Hi,
try with
Hi,
try with this:
FFITutorial>>getHostNameInto: hostName ofLenght: length
^self ffiCall: #( int gethostname(char *hostName, int length) )
library: 'Ws2_32.dll'. "... on Windows"
From Playground, you can then do:
| name len |
len := 50.
name:= ByteArray new: len.
FFITutorial new getHos
ary:
'libc.so.6'.
^nameBuffer asString
Thanks,
Gerry
From: Esteban Lorenzano
Sent: Sunday, November 28, 2021 3:09 AM
To: Any question about pharo is welcome
Cc: pharo-users@lists.pharo.org
Subject: [Pharo-users] Re: uFFI provide buffer to C
hi,
hi,
it should be ByteArray.
if you explain more in detail your problem, I can try to help you better :)
Esteban
On Nov 28 2021, at 9:20 am, Gerry Weaver wrote:
>
> Hello All,
>
> Pharo newbie here. I'm playing around with uFFI and I'm having trouble
> figuring out how to provide a buffer to C.