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
Andriy Palamarchuk apa3a@yahoo.com writes:
The same happens for some other file functions. What is the correct fix for this problem?
Just remove msvcrt from the import list, it isn't needed (or if you really want to use msvcrt, then you have to use the msvcrt headers too instead of the libc ones).
--- Alexandre Julliard julliard@winehq.com wrote:
Andriy Palamarchuk apa3a@yahoo.com writes:
The same happens for some other file functions. What is the correct fix for this problem?
Just remove msvcrt from the import list, it isn't needed (or if you really want to use msvcrt, then you have to use the msvcrt headers too instead of the libc ones).
My lack of understanding - what is correct approach in Winelib applications - to use msvcrt or native functions?
I always thought that correct approach is to use msvcrt ones.
Andriy
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Andriy Palamarchuk apa3a@yahoo.com writes:
My lack of understanding - what is correct approach in Winelib applications - to use msvcrt or native functions?
I always thought that correct approach is to use msvcrt ones.
Unless you depend on msvcrt-specific features, it's better to use the Unix C library. It will use less memory and load faster.
--- Andriy Palamarchuk apa3a@yahoo.com wrote:
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
Hate to say it, but maybe we need yet *another* #ifdef... something like
#ifdef __IA64__ #define _FILE_OFFSET_BITS 64 #endif
yes i know that __IA64__ isnt anything but i was just using it for example...
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com