>> Yesterday we have implemented the image side part in P10 to correctly
   honour the calling convention.

Does this imply that uFFI doesn't work correctly on current images?
Because uFFI should have been available since Pharo 8, according to the
uFFI manual.  Or is it a revamped implementation?

>> On the other hand, you are asking about ThisCall. This calling
   conventionis only relevant in 32bits systems. What is your target
   system/library? Does it not exist as 64-bit library?

Unfortunately it is a legacy library with no 64 bit version. No problem,
because I can write a wrapper, yet I was wondering if Pharo offered any
facilities to avoid that.

Thank you for the information.

----------------------------------------------------------------------
Message: 1
Date: Thu, 26 Aug 2021 15:38:48 +0200
From: "teso...@gmail.com" <teso...@gmail.com>
Subject: [Pharo-users] Re: uFFI: Calling conventions?
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Message-ID:
        <cam9-ed+dyajdof0gfbcypmv9cqqufmszumc51ealrzs2ycs...@mail.gmail.com>
Content-Type: multipart/alternative;
        boundary="0000000000004711e205ca767def"

Hi All,
    The answer is yes and no.
Let's go step by step.
To declare the calling convention a class can override the method
#ffiCallingConvention. Returning a Symbol representing the Calling
Convention.

Yesterday we have implemented the image side part in P10 to correctly
honour the calling convention.
I have implemented it for X86 but this can be easily extended to ARM32
(ARM64 has a single calling convention).
If this fix is useful, it can be backported to P9.

However, this only works for X86_64 as it depends on the new FFI
implementation. We still do not have an X86 32 bits VM, it is possible to
compile it from sources, but we are not distributing it.

In X86_64 only exists the Windows and the GNU calling convention, we are
supporting both.

On the other hand, you are asking about ThisCall. This calling convention
is only relevant in 32bits systems. What is your target system/library?
Does it not exist as 64-bit library?

Thanks

On Tue, Aug 24, 2021 at 9:33 PM egarrulo <egarr...@gmail.com> wrote:

Hi all,

I haven't found any information on calling conventions in the "Unified
FFI - Calling Foreign Functions from Pharo" manual. What conventions are
available, please?

If the ThisCall[1] convention isn't supported, could it be implemented
in code with some boilerplate?

Thank you.

--

[1] ThisCall works like StdCall, but the first parameter - the "this"
pointer - is passed via the ECX register.


Reply via email to