[Cuis-dev] FFI example
Andres Valloud
ten at smallinteger.com
Sun Sep 29 20:10:10 PDT 2024
Except of course getenv() is ruled by POSIX so doing that is at the very
least not portable, if not outright wrong.
On 9/29/24 6:29 PM, Vanessa Freudenberg via Cuis-dev wrote:
> And, defining a method myself works fine:
>
> getenv: var
> <cdecl: char* 'getenv' (char*) module: 'libSystem.dylib'>
> ^self externalCallFailed
>
> And then
>
> MyClass getenv: 'HOME'
>
>
> returns
>
> '/Users/vanessa' .
>
>
> There really isn't much more to it.
>
> Vanessa
>
> On Sun, Sep 29, 2024 at 6:26 PM Vanessa Freudenberg
> <vanessa at codefrau.net <mailto:vanessa at codefrau.net>> wrote:
>
> I just loaded the "Tests-FFI" package and it works.
>
> And you can e.g. run
>
> FFITestLibrary new ffiTestFloats: 3 with: 4
>
> which returns 7.0 because the plugin happens to implement
> "ffiTestFloats()" as returning the sum of its two arguments.
>
> Vanessa
>
>
More information about the Cuis-dev
mailing list