Hi,

Thanks for the example. Unfortunately, it doesn't work on Linux.

Thanks,
Gerry


________________________________
From: Tomaž Turk <tomaz.t...@ef.uni-lj.si>
Sent: Sunday, November 28, 2021 11:39 AM
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: uFFI provide buffer to C

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 getHostNameInto: name ofLenght: len.
name inspect.

I hope this helps.

Best wishes,
Tomaz

Reply via email to