[fpc-pascal] Problem compiling DLL for 64Bit Windows - complete example attached

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 18 13:50:01 CET 2009


On 18 Dec 2009, at 13:39, Lukas Gradl wrote:

>> >   rMonitor=packed record
>> ...
>>>  end;
>>>
>>>  rMonitorEx=packed record
>>>    dwMonitorSize:DWORD;
>>>    Monitor:rMonitor;
>>>  end;
>> Are you sure the C record is packed too ? This would mean that all  
>> function pointers in rMonitor are not aligned.
>
> I'm not shure about that as I'm not that good at C. The packed  
> record works at 32bit -so I thought that should be correct.

You must never use a "packed" record for a C record, unless it is  
declared in C using __attribute__((__packed__)). The fact that it  
worked in 32 bit was pure coincidence. You also have to add  
{$packrecords c} to your source file to tell the compiler to lay out  
records the same way as C compilers to guarantee interoperability.


Jonas



More information about the fpc-pascal mailing list