public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* problem with fortran common block in shared library
@ 2017-01-06 15:26 Bill Greene
  2017-01-06 15:45 ` Arjen Markus
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Greene @ 2017-01-06 15:26 UTC (permalink / raw)
  To: cygwin

I am encountering the same problem as described in this post:

https://cygwin.com/ml/cygwin/2015-06/msg00352.html

However none of the responses in this thread indicate whether
this is a bug or whether there is a workaround.

Can someone kindly provide more information on this issue?

Thanks,

Bill Greene

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fortran common block in shared library
  2017-01-06 15:26 problem with fortran common block in shared library Bill Greene
@ 2017-01-06 15:45 ` Arjen Markus
  2017-01-06 15:53   ` Bill Greene
  0 siblings, 1 reply; 4+ messages in thread
From: Arjen Markus @ 2017-01-06 15:45 UTC (permalink / raw)
  To: Andrey Repin

I see I replied to that first message - completely forgot about it.

I have just tried a bunch of varieties of !GCC$ ... but none seem to
work. Perhaps you should ask on the GFortran list or on
comp.lang.fortran too.

Regards,

Arjen

2017-01-06 16:26 GMT+01:00 Bill Greene <w.h.greene@gmail.com>:
> I am encountering the same problem as described in this post:
>
> https://cygwin.com/ml/cygwin/2015-06/msg00352.html
>
> However none of the responses in this thread indicate whether
> this is a bug or whether there is a workaround.
>
> Can someone kindly provide more information on this issue?
>
> Thanks,
>
> Bill Greene
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fortran common block in shared library
  2017-01-06 15:45 ` Arjen Markus
@ 2017-01-06 15:53   ` Bill Greene
  2017-03-01 18:49     ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Greene @ 2017-01-06 15:53 UTC (permalink / raw)
  To: cygwin

This problem is not a generic gcc/gfortran one.
If you build the test code on Linux, it works correctly.

Bill

On Fri, Jan 6, 2017 at 10:45 AM, Arjen Markus <arjen.markus895@gmail.com> wrote:
> I see I replied to that first message - completely forgot about it.
>
> I have just tried a bunch of varieties of !GCC$ ... but none seem to
> work. Perhaps you should ask on the GFortran list or on
> comp.lang.fortran too.
>
> Regards,
>
> Arjen
>
> 2017-01-06 16:26 GMT+01:00 Bill Greene <w.h.greene@gmail.com>:
>> I am encountering the same problem as described in this post:
>>
>> https://cygwin.com/ml/cygwin/2015-06/msg00352.html
>>
>> However none of the responses in this thread indicate whether
>> this is a bug or whether there is a workaround.
>>
>> Can someone kindly provide more information on this issue?
>>
>> Thanks,
>>
>> Bill Greene
>>
>> --
>> Problem reports:       http://cygwin.com/problems.html
>> FAQ:                   http://cygwin.com/faq/
>> Documentation:         http://cygwin.com/docs.html
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fortran common block in shared library
  2017-01-06 15:53   ` Bill Greene
@ 2017-03-01 18:49     ` Marco Atzeri
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Atzeri @ 2017-03-01 18:49 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

On 06/01/2017 16:52, Bill Greene wrote:
> This problem is not a generic gcc/gfortran one.
> If you build the test code on Linux, it works correctly.
>
> Bill
>

the problem is gfortran one on Windows platform

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47030
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68040

If you create a directive like

--------------------------------------
!GCC$ ATTRIBUTES DLLEXPORT :: /cb1/
       integer cvar
       common /cb1/ cvar
--------------------------------------

It produces and error like
--------------------------------------
  !GCC$ ATTRIBUTES DLLEXPORT :: /cb1/
                                1
Error: Invalid character in name at (1)
--------------------------------------

so the DLLEXPORT directive is not correctly
managing "common" as "/cb1/"

I also noted that the "!GCC$" must be at the beginning of the line
otherwise is totally ignored, that is also very hard to note.

Regards
Marco








[-- Attachment #2: cb_test-3.sh --]
[-- Type: text/plain, Size: 1199 bytes --]

#!/bin/sh -x
cat >cb_main.f <<\EOF
      program cb_main
      !GCC$ ATTRIBUTES DLLEXPORT :: /cb1/
      integer cvar
      common /cb1/ cvar
      cvar = 0
      call cb_func()
      if(cvar.eq.2) then
          write(*,*)'GOOD COMMON BLOCK'
      else
          write(*,*)'BAD COMMON BLOCK'
      endif
      end
EOF
cat >cb_func.f <<\EOF
      subroutine cb_func()
      !GCC$ ATTRIBUTES DLLIMPORT :: /cb1/
      integer cvar
      common /cb1/ cvar
      cvar = 2
      cvar2 = 2
      end
EOF
################################################################################
rm -f *.o *.dll *.a *.exe
gfortran -c cb_func.f 
gfortran -c cb_main.f 
################################################################################
ar cr libcb_static.a cb_func.o
gfortran cb_main.o -L. -lcb_static -o cb_main_static
################################################################################
gfortran -shared -o libcb_dynamic.dll cb_func.o 
gfortran cb_main.o -L. -lcb_dynamic -o cb_main_dynamic 
################################################################################
./cb_main_static
./cb_main_dynamic
################################################################################

[-- Attachment #3: cb_test-2.sh --]
[-- Type: text/plain, Size: 1187 bytes --]

#!/bin/sh -x
cat >cb_main.f <<\EOF
      program cb_main
!GCC$ ATTRIBUTES DLLEXPORT :: /cb1/
      integer cvar
      common /cb1/ cvar
      cvar = 0
      call cb_func()
      if(cvar.eq.2) then
          write(*,*)'GOOD COMMON BLOCK'
      else
          write(*,*)'BAD COMMON BLOCK'
      endif
      end
EOF
cat >cb_func.f <<\EOF
      subroutine cb_func()
!GCC$ ATTRIBUTES DLLIMPORT :: /cb1/
      integer cvar
      common /cb1/ cvar
      cvar = 2
      cvar2 = 2
      end
EOF
################################################################################
rm -f *.o *.dll *.a *.exe
gfortran -c cb_func.f 
gfortran -c cb_main.f 
################################################################################
ar cr libcb_static.a cb_func.o
gfortran cb_main.o -L. -lcb_static -o cb_main_static
################################################################################
gfortran -shared -o libcb_dynamic.dll cb_func.o 
gfortran cb_main.o -L. -lcb_dynamic -o cb_main_dynamic 
################################################################################
./cb_main_static
./cb_main_dynamic
################################################################################

[-- Attachment #4: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-01 18:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 15:26 problem with fortran common block in shared library Bill Greene
2017-01-06 15:45 ` Arjen Markus
2017-01-06 15:53   ` Bill Greene
2017-03-01 18:49     ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).