This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [ANNOUNCEMENT] Updated: experimental package: gcc4-4.3.2-2
Angelo Graziosi wrote:
> Still continuing to test...
>
> Marco Atzeri wrote:
>> if I had ./test_program I see the output on the screen but
>>
>> ./test_program > test_output
>> leave test_output empty.
>
> If I build that tst case with:
>
> gfortran-4 test_program.F -o test_program
>
> then
>
> $ ./test_program.exe
> SUCCESS
>
> $ ./test_program.exe > test_output
>
> $ cat test_output
> SUCCESS
Hmm, doesn't work here. 1.5 or 1.7? This is 1.7:
admin@ubik /tmp/fortran/hw
$ cat hw.F
program main
WRITE(*,*) 'SUCCESS'
end
admin@ubik /tmp/fortran/hw
$ gfortran-4 hw.F -o test_program
admin@ubik /tmp/fortran/hw
$ ./test_program.exe > test_output
admin@ubik /tmp/fortran/hw
$ cat test_output
admin@ubik /tmp/fortran/hw
$ cygcheck ./test_program.exe
F:\cygwin-1.7\tmp\fortran\hw\test_program.exe
F:\cygwin-1.7\bin\cygwin1.dll
C:\WINNT\system32\ADVAPI32.DLL
C:\WINNT\system32\NTDLL.DLL
C:\WINNT\system32\KERNEL32.DLL
C:\WINNT\system32\RPCRT4.DLL
F:\cygwin-1.7\bin\cyggcc_s-1.dll
F:\cygwin-1.7\bin\cyggfortran-3.dll
admin@ubik /tmp/fortran/hw
> But if I build with:
>
> gfortran-4 -shared test_program.F -o test_program
>
> then
>
> $ ./test_program.exe
> bash: ./test_program.exe: Permission denied
>
> i.e. it does not work at all!
>
> What am I missing?
-shared is not (surprisingly) the opposite of -static!
-static means link your app against static libs, not DLLs.
-shared means build your app as a DLL, not an EXE!
In particular, if you have '-shared', gcc adds '-e __cygwin_dll_entry@12' to
the linker flags, which means that it gets a DllMain function for its
entrypoint instead of your standard main(argc, argv).
If you want to link against shared DLLs, you need add no options at all;
that's the default for all the languages (except plain C).
cheers,
DaveK
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/