Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

Error 7371 with save attribute in submodule routine

Wolf_W_
New Contributor I
279 Views

Hi,

i was placing some routines in submodules, when i stumbled upon this error:

error #7371: An object in a COMMON block with DEC$ ATTRIBUTES DLLIMPORT cannot be initialized. [BAR]

Reproducer:

module M_TEST
  implicit none

  interface

    module real function foo()
      !DIR$ ATTRIBUTES DLLEXPORT,ALIAS:"foo" :: foo
    end function

  end interface

end module


submodule(M_TEST) M_TEST_S
  implicit none

  contains
    module real function foo()
      !DIR$ ATTRIBUTES DLLEXPORT :: foo

      real, save :: bar = 1.0 ! Explicit save not required for error

      foo = 1.0
    end function

end submodule

Compiler: 16.3.207
Options: /dll /nologo

Best regards,

Wolf

0 Kudos
1 Reply
Xiaoping_D_Intel
Employee
279 Views

Thanks for reporting the issue. I have reproduced it and opened a defect report DPD200413429 for it.

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos
Reply