[fpc-pascal] Stack alignmennt in call from C++ to FPC
Josue Andrade Gomes
josuegomes at gmail.com
Thu Jun 6 14:40:24 CEST 2013
On Wed, Jun 5, 2013 at 5:44 PM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 05 Jun 2013, at 15:04, Josue Andrade Gomes wrote:
>
>> Some references (eg (2)) claim that MSVC aligns the stack at 4-byte
>> boundaries while GCC aligns
>> at 16-byte boundaries. I have found no confirmation on those claims.
>
> Stack alignment is not a compiler property, but a platform property. The stack alignment on Win32 is 4 bytes. On Linux/i386 it used to 4 bytes, but there has been an unofficial switch to 16 bytes (which, in all fairness, was pushed by gcc for SSE/performance reasons).
>
> I don't immediately see what the problem is in your case. Usually it's a mismatch of calling conventions, but that seems to be fine in the code you posted.
>
Thanks for your answer. Anyway the problem seems to be something else.
I have written a small test but could not reproduce the problem. I'll
continue investigation.
If someone is interested my small test can be found at
www.josuegomes.com/fp-msvc.zip
It contains a DLL built with MSVC and two Pascal applications that
load the DLL, pass the callback function
and call it.
Thanks again for your help. If I find something of interest I'll post it here.
regards,
josue
More information about the fpc-pascal
mailing list