This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fstat problem: linking with crt or msvc?


Hubert Garavel wrote:
> 
> I face a backward compatibility problem with fstat() due to a recent
> change in gcc -mno-cygwin (the new GCC links against MVSC instead of CRT).
> There have been already a few posts on this issue, but my question is
> different.
> 
> I have a binary library (".a" file) which calls fstat().
> This library was obtained by cross-compilation using an older GCC
> that links against CRTDLL (gcc version 2.95.2 19991024 (release-2).
> 
> This library worked well on previous versions of Cygwin, but fails
> on the recent ones (lasting from 2001). It seems that, when linked to MSVC,
> fstat() uses different data structures and returns different results than
> when linked to CRT.
> 
> If possible, I would keep the .a library unchanged.
> 
> Which options should be given to the new gcc (in addition -mno-cygwin)
> so that it continues to link against CRTDLL as before and uses the
> appropriate include files for this? This is really a backard compatibility
> model.
> 

I've attached a specs-crtdll file that should work for what you want. 
To use it you would `gcc -specs=specs-crtdll'.

> Thanks in advance
> Hubert
> 
> PS: For my curiosity, what are the reasons for switching from CRT to MSVC ?
> 

The reason is that CRTDLL is deprecated.  It was created for Win95
version 1.  Microsoft changed to MSVCRT with Win95 version 2.  I polled
this list before the change was made.  No one spoke against the change.

Earnie.

P.S.:  Caveat Emptor: I did not test the specs file.  I simply made the
changes I remembered to be necessary.
*asm:


*asm_final:


*cpp:
  %{mno-win32: %{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}}   %(cpp_cpu) %{posix:-D_POSIX_SOURCE}   %{mno-cygwin:-D__MINGW32__ %{mthreads:-D_MT} -isystem /usr/include/mingw/g++-3 -isystem /usr/include/mingw/g++ -isystem /usr/local/include/mingw -idirafter /usr/include/mingw}   %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix     -isystem /usr/local/include -idirafter /usr/include}   %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter /usr/include/w32api}   

*cc1:
%(cc1_spec) 

*cc1plus:


*endfile:


*link:
%{mwindows:--subsystem windows}   %{mconsole:--subsystem console}   %{shared: %{mdll: %eshared and mdll are not compatible}}   %{shared: --shared} %{mdll:--dll}   %{static:-Bstatic} %{!static:-Bdynamic}   %{shared|mdll: -e     %{mno-cygwin:_DllMainCRTStartup@12}     %{!mno-cygwin:__cygwin_dll_entry@12}}  --dll-search-prefix=cyg

*lib:
%{pg:-lgmon}   %{!mno-cygwin:-lcygwin}   %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32}   %{mwindows:-lgdi32 -lcomdlg32}   -luser32 -lkernel32 -ladvapi32 -lshell32

*libgcc:
%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lcoldname -lcrtdll}

*startfile:
%{shared|mdll: %{mno-cygwin:dllcrt1%O%s}}   %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:-L/usr/lib/mingw mingw/crt1%O%s}   %{pg:gcrt0%O%s}}}

*switches_need_spaces:


*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}

*predefines:
-Di386 -D__386__ -D__i386 -D_X86=1 -D__STDC__=1   -D__stdcall=__attribute__((__stdcall__))   -D__cdecl=__attribute__((__cdecl__))   -D__declspec(x)=__attribute__((x))   -Asystem(winnt) -Acpu(i386) -Amachine(i386)

*cross_compile:
0

*version:
gcc-2.95.2-9

*multilib:
. ;

*multilib_defaults:


*multilib_extra:


*multilib_matches:


*linker:
collect2

*cpp_486:
%{!ansi:-Di486} -D__i486 -D__i486__

*cpp_586:
%{!ansi:-Di586 -Dpentium} 	-D__i586 -D__i586__ -D__pentium -D__pentium__

*cpp_k6:
%{!ansi:-Di586 -Dk6} 	-D__i586 -D__i586__ -D__k6 -D__k6__

*cpp_686:
%{!ansi:-Di686 -Dpentiumpro} 	-D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__

*cpp_cpu_default:
%(cpp_686)

*cpp_cpu:
-Acpu(i386) -Amachine(i386) %{!ansi:-Di386} -D__i386 -D__i386__ %{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} %{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} %{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} %{mcpu=k6:%(cpp_k6)} %{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}

*cc1_cpu:
%{!mcpu*: %{m386:-mcpu=i386 -march=i386} %{m486:-mcpu=i486 -march=i486} %{mpentium:-mcpu=pentium} %{mpentiumpro:-mcpu=pentiumpro}}

*mingw_include_path:
i686-pc-cygwin

*link_command:
%{!fsyntax-only:  %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} 			%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}			%{!A:%{!nostdlib:%{!nostartfiles:%S}}}			%{static:} %{L*} %D %o			%{!nostdlib:%{!nodefaultlibs:%G %L %G}}			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}			%{T*}			
 }}}}}}


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]