X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <49BB1EA4.6080602@gmail.com> Date: Sat, 14 Mar 2009 03:04:04 +0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [ANNOUNCEMENT] Updated: experimental package: gcc4-4.3.2-2 References: <49B90A2B DOT 3050907 AT alice DOT it> <49BA7A8E DOT 3070207 AT alice DOT it> <49BA9D05 DOT 3010000 AT alice DOT it> <49BAF849 DOT 4080403 AT alice DOT it> In-Reply-To: <49BAF849.4080403@alice.it> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 AT ubik /tmp/fortran/hw $ cat hw.F program main WRITE(*,*) 'SUCCESS' end admin AT ubik /tmp/fortran/hw $ gfortran-4 hw.F -o test_program admin AT ubik /tmp/fortran/hw $ ./test_program.exe > test_output admin AT ubik /tmp/fortran/hw $ cat test_output admin AT 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 AT 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 AT 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/