From: Alois S. <alo...@gm...> - 2010-11-19 12:19:24
|
Hi Tor, thanks for your reply. this helped me to understand the problem. On 11/17/10 15:19, Tor Lillqvist wrote: >> The project contains a function declaration for a function sopen(), >> which differs from the definition in i686-pc-mingw32/include/io.h >> > You need to either rename your own sopen() then, or look more closely > in io.h and see that the declaration of sopen() is inside #ifndef > _NO_OLDNAMES. So passing a -D_NO_OLDNAMES might help? You just might > need to call other more common functions like open() and close() using > their underscore-prefixed name then. > > -D_NO_OLDNAMES breaks a few other thinks related to zlib.h and unistd.h, it starts with error: expected declaration specifiers or '...' before 'off_t' and results in a whole bunch of additional errors. >> The same source compiles on Linux. >> > In what way is that relevant? > > Because the aim of MinGW is enabling to compile gnu c/c++ programs for the windows platform ? >> So the question is how can I avoid >> the visibility of the internal mingw functions ? >> > sopen() (and the equivalent _sopen()) are not "internal mingw > functions". They are functions in the Microsoft C library that have a > specific and useful functionality. > This raises the question, how to turn off using these extensions of some MS C library which I do not need and do not want. > --tml > > P.S.: Peter, the option -nodefaultlibs applies only the the linking step, the problem occurred at compilation. The problem finally went away after applying the following patch to io.h; the definition for the functions sopen and _sopen are removed. *** /home/schloegl/src/mingw-cross-env/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/io.h.orig Fri Nov 19 13:13:44 2010 --- /home/schloegl/src/mingw-cross-env/usr/lib/gcc/i686-pc-mingw32/4.5.1/../../../../i686-pc-mingw32/include/io.h Fri Nov 19 13:13:15 2010 *************** *** 375,381 **** /* SH_... flags for nShFlags defined in share.h * Optional fourth argument is unsigned unPermissions */ ! _CRTIMP int __cdecl __MINGW_NOTHROW _sopen (const char*, int, int, ...); _CRTIMP long __cdecl __MINGW_NOTHROW _tell (int); /* Should umask be in sys/stat.h and/or sys/types.h instead? */ --- 375,381 ---- /* SH_... flags for nShFlags defined in share.h * Optional fourth argument is unsigned unPermissions */ ! //_CRTIMP int __cdecl __MINGW_NOTHROW _sopen (const char*, int, int, ...); _CRTIMP long __cdecl __MINGW_NOTHROW _tell (int); /* Should umask be in sys/stat.h and/or sys/types.h instead? */ *************** *** 451,457 **** _CRTIMP int __cdecl __MINGW_NOTHROW open (const char*, int, ...); _CRTIMP int __cdecl __MINGW_NOTHROW read (int, void*, unsigned int); _CRTIMP int __cdecl __MINGW_NOTHROW setmode (int, int); ! _CRTIMP int __cdecl __MINGW_NOTHROW sopen (const char*, int, int, ...); _CRTIMP long __cdecl __MINGW_NOTHROW tell (int); _CRTIMP int __cdecl __MINGW_NOTHROW umask (int); _CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*); --- 451,457 ---- _CRTIMP int __cdecl __MINGW_NOTHROW open (const char*, int, ...); _CRTIMP int __cdecl __MINGW_NOTHROW read (int, void*, unsigned int); _CRTIMP int __cdecl __MINGW_NOTHROW setmode (int, int); ! //_CRTIMP int __cdecl __MINGW_NOTHROW sopen (const char*, int, int, ...); _CRTIMP long __cdecl __MINGW_NOTHROW tell (int); _CRTIMP int __cdecl __MINGW_NOTHROW umask (int); _CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*); |