Problem with 64-bit file functions declarations

Andriy Palamarchuk apa3a at yahoo.com
Fri May 31 10:08:32 CDT 2002


I'm researching an issue when started regedit.exe
fails to export registry. This started to happen after
Alexandre's patch which included "config.h" in the
regedit source file.

I found out this problem was triggered by declaration

#define _FILE_OFFSET_BITS 64

in config.h. The test case:

********************************************
/* Set this to 64 to enable 64-bit file support on
Linux */
#define _FILE_OFFSET_BITS 64

#include <stdio.h>
#include <windows.h>

void test_write(void) 
{
    FILE *f = fopen("1.reg", "w");
    printf("sizeof FILE: %d\n", sizeof(FILE));
    fputs("DEBUG1\n", f);
    fclose(f);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE
hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    test_write();
    exit(0);
}
********************************************

Comment out the macro definition and it works, with
macro it creates file of 0 length.
With the defined macro many file functions are defined
as functions for 64-bit access and are linked to the
native platform calls instead of msvcrt ones.

Differences in precompilation output:

Without macro:

# 203 "/usr/include/stdio.h" 3
extern FILE *fopen (__const char *__restrict
__filename,
                    __const char *__restrict __modes)
;

With macro:

# 211 "/usr/include/stdio.h" 3
extern FILE *fopen (__const char *__restrict
__filename,
                    __const char *__restrict __modes)
__asm__ ("" "fopen64");

The same happens for some other file functions.
What is the correct fix for this problem?

Andriy

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the wine-devel mailing list