Call function in the same module in Fortran90

I am new to Fortran90 and I have not found the answer to the question that I have. I have a module written in Fortran with some functions inside the module.

Truncated version:

  module vdiStringFunctions

vdiString interface modular procedure vdiString1Char end interface

contains a character (128) function vdiString1Char (CSTRING, sVar1) character (*), target (in) :: CSTRING, sVar1 character (128) :: vdiStringGeneral character (len = 128), dimension (0: 9) :: stringArray

stringArray(0) = adjustl(sVar1) vdiString1Char= vdiStringGeneral(CSTRING, stringArray) end function vdiString1Char character (128) function vdiStringGeneral(CSTRING, varArray) character(*), intent(in) :: CSTRING character(len=128), dimension(0:9), intent(in) :: varArray vdiStringGeneral = 'bla' end function vdiStringGeneral

end module vdiStringFunctions

When I try to compile with Intel Visual Fortran XE 2011, I get the following error:

error LNK2019: unresolved external symbol _VDISTRINGGENERAL specified in _VDISTRINGFUNCTIONS_mp_VDISTRING1CHAR vdiStringFunctions.obj

Since the vdiStringGeneral function is in the same module as the calling vdiString1Char, I am not getting the problem. When I move vdiStringGeneral outside the module, it compiles without problems.

Since it must be used in a DLL, all functions must be inside the module. How can I make it work this way?

+4
source share
1 answer

Remove the vdiStringGeneral in the vdiString1Char function. The interface for vdiStringGeneral already explicit, because it is defined in the same module. With the ad you have, the linker is looking for an external function.

+4
source

All Articles