tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] missing SetFilePointerEx


From: grischka
Subject: Re: [Tinycc-devel] missing SetFilePointerEx
Date: Sun, 31 Jan 2010 21:38:54 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Zsidi László wrote:

Hi Gabor,
I make a definition file from kernel32.dll by the tiny_impdef.exe and compile seek.c with tcc ( tcc.exe seek.c kernel32.def ).
The output is:
Size:495
Seems to be is work well...

You probably compiled in 32bit mode.

It does not work on 64bit.  Reason is a missing detail in the
calling conventions for x64 windows, that structures of size
1,2,4,8 need to be passed in registers.

The structure in question here is
  LARGE_INTEGER liDistanceToMove;
  SetFilePointerEx(hFile, liDistanceToMove, ... );

See also x64 windows calling conventions:
  http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx

Do not expect me personally to fix this.

--- grischka


Gabor Gyorgy Nagy <address@hidden> írta:

    Hi list,
seek.c: #include <windows.h>
    #include <stdio.h>
#define O_RFLAG GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL
int main(void)
    {
    HANDLE hFile;
    LARGE_INTEGER liDistanceToMove;
    LARGE_INTEGER liNewFilePointer;
hFile = CreateFile("seek.c", O_RFLAG, NULL); liDistanceToMove.QuadPart = 0;
    if (SetFilePointerEx(hFile, liDistanceToMove, &liNewFilePointer,
    FILE_END) != FALSE) {
    printf("size:%I64d\n", liNewFilePointer.QuadPart);
    }
    CloseHandle(hFile);
    return 0;
    }
x86_64-pc-mingw32-gcc.exe seek.c
    a.exe:
    size:508
(tcc x86_64: http://repo.or.cz/w/tinycc.git, 2010-01-14)
    tcc seek.c
    tcc: error: undefined symbol 'SetFilePointerEx'
write SetFilePointerEx to kernel32.def: tcc seek.c
    -no error
seek.exe:
    seek.exe has stopped working
---
    Gabor
Hi list,seek.c:#include #include #define O_RFLAG GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL

    int main(void){ HANDLE hFile; LARGE_INTEGER liDistanceToMove;

    LARGE_INTEGER liNewFilePointer;
    hFile = CreateFile(&quot;seek.c&quot;, O_RFLAG, NULL);

    liDistanceToMove.QuadPart = 0;
    if (SetFilePointerEx(hFile, liDistanceToMove, &amp;liNewFilePointer, 
FILE_END) != FALSE) {

    printf(&quot;size:%I64d\n&quot;, liNewFilePointer.QuadPart); }
    CloseHandle(hFile);

    return 0;}x86_64-pc-mingw32-gcc.exe seek.ca.exe:size:508

    (tcc x86_64: http://repo.or.cz/w/tinycc.git, 2010-01-14)tcc seek.ctcc: error: 
undefined symbol &#39;SetFilePointerEx&#39;write SetFilePointerEx to 
kernel32.def:

    tcc seek.c-no errorseek.exe:seek.exe has stopped working---Gabor





reply via email to

[Prev in Thread] Current Thread [Next in Thread]