[fpc-pascal] SizeOf(File) <> SizeOf(FileRec)

Søren Ager sorenager at poboxes.com
Tue May 24 20:03:28 CEST 2005


Tomas Hajny wrote:

> BTW (just in case you didn't know), one good thing 
> about GDB and the current environment is the possibility of post-
> mortem debugging in case it crashed completely with a core dump 
> ("core core" in (PM)GDB).

I didn't know that - thanks for the tip.

I have now compiled and run my first program without errors - but it 
required me to manually modify the .s file before assembly and 
linking... Here are the details:

In so32dll.pas I have:
function connect(sock:Longint; const s_addr:sockaddr; 
s_addr_len:Longint):Longint; cdecl; external 'SO32DLL' index 3;

That is called from sockets.pas:
Function Connect(Sock:Longint;const Addr; Addrlen:Longint):Boolean;
begin
   Connect:=so32dll.Connect(Sock,so32dll.SockAddr(Addr),AddrLen)=0;
   if not Connect then
     SocketError:=so32dll.sock_errno
   else
     SocketError:=0;
end;

The code generated for that call is:
# [214] Connect:=so32dll.Connect(Sock,so32dll.SockAddr(Addr),AddrLen)=0;
     pushl   -12(%ebp)
     movl    -8(%ebp),%esi
     subl    $16,%esp
     movl    %esp,%edi
     cld
     movl    $16,%ecx
     rep
     movsb
     pushl   -4(%ebp)
     call    SO32DLL_CONNECT$LONGINT$SOCKADDR$LONGINT$$LONGINT

BUT that crashes the program in SO32DLL

I then changed it to:
# [214] Connect:=so32dll.Connect(Sock,so32dll.SockAddr(Addr),AddrLen)=0;
     pushl   -12(%ebp)
     pushl   -8(%ebp)
     pushl   -4(%ebp)
     call    SO32DLL_CONNECT$LONGINT$SOCKADDR$LONGINT$$LONGINT

Ant then it works!!

What do I need to do to make the compiler output that code so my program 
can run without errors?


Take care,
   Søren




More information about the fpc-pascal mailing list