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

Submodule with DLLEXPORT + typebound renamed procedure

Wolf_W_
New Contributor I
560 Views

Hi,

while moving from IFORT 18.0 to 18.1 i got a linking problem with submodules. The following Code produces a linker error LNK2019 "Unresolved external symbol "FOO" in function "MOD_A_mp_SOME_ROUTINE".

module MOD_A

  type, public :: BAR_TYPE
    contains
      procedure, nopass :: foo    => special_foo
  end type BAR_TYPE

  interface
    module subroutine special_foo()
      !DEC$ ATTRIBUTES DLLEXPORT :: special_foo
    end subroutine special_foo
  end interface

contains

  subroutine some_routine()
    !DEC$ ATTRIBUTES DLLEXPORT :: some_routine
    type(BAR_TYPE) :: bar
    call bar%foo()
  end subroutine some_routine

end module MOD_A


submodule(MOD_A) MOD_A_S_GERADE
contains
  module subroutine special_foo()
    !DEC$ ATTRIBUTES DLLEXPORT :: special_foo
  end subroutine special_foo
end submodule MOD_A_S_GERADE

This worked in previous compiler versions. It works without the submodule:

module MOD_A

  type, public :: BAR_TYPE
    contains
      procedure, nopass :: foo    => special_foo
  end type BAR_TYPE

contains

  subroutine special_foo()
    !DEC$ ATTRIBUTES DLLEXPORT :: special_foo
  end subroutine special_foo

  subroutine some_routine()
    !DEC$ ATTRIBUTES DLLEXPORT :: some_routine
    type(BAR_TYPE) :: bar
    call bar%foo()
  end subroutine some_routine

end module MOD_A

Greetings

Wolf

0 Kudos
1 Solution
Lorri_M_Intel
Employee
560 Views

I compiled your program with an internal compiler for 18.0, and it did not get an undefined symbol for FOO.  

It was missing a MAIN routine, but that's not a surprise.  :-)

This lets me believe that it is repaired, and the fix will be in the 18.0 update 2 kit, to be released soon.

As much as I would love to give an exact date for when "soon" is, I can't.   All I can do is say "soon".

    --Lorri

 

View solution in original post

0 Kudos
4 Replies
FortranFan
Honored Contributor II
560 Views

See this thread, you may be running into a known issue with SUBMODULEs in 18.0 update 1:

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/753974

 

0 Kudos
Wolf_W_
New Contributor I
560 Views

Thank you for the link. I just noticed, that the DLLEXPORT attribute is not related to the problem. So it is propably exact the same problem.

0 Kudos
Johannes_Rieke
New Contributor III
560 Views

I agree FortranFan, that this looks like the known submodule linking error introduced with 18.0.1. I filed my error at Intel's OSC on 12/06/2017. However, besides Lorri's answer in the thread above, I got no answer, whether PSXE 18 update 2 will solve this issue completely nor when update 2 will be released.

ps: another example can be found here: https://software.intel.com/en-us/node/740567

0 Kudos
Lorri_M_Intel
Employee
561 Views

I compiled your program with an internal compiler for 18.0, and it did not get an undefined symbol for FOO.  

It was missing a MAIN routine, but that's not a surprise.  :-)

This lets me believe that it is repaired, and the fix will be in the 18.0 update 2 kit, to be released soon.

As much as I would love to give an exact date for when "soon" is, I can't.   All I can do is say "soon".

    --Lorri

 

0 Kudos
Reply