Calling function in same module in Fortran90
I am new to Fortran90 and I haven't found an answer to a problem I have. I have a module written in Fortran with the some functions inside a module.
Stripped down version:
module vdiStringFunctionsinterface vdiString module procedure vdiString1Char end interface
contains character (128) function vdiString1Char(CSTRING, sVar1) character(*), intent(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 referenced in function _VDISTRINGFUNCTIONS_mp_VDISTRING1CHAR vdiStringFunctions.obj
Because the function vdiStringGeneral is in the same module than the calling vdiString1Char I do not get the problem. When I move the vdiStringGeneral outside of the module it compiles without problems.
Because it should be used in a DLL all functions should be inside开发者_开发问答 the module. How can I get it to work that way?
Remove the declaration of vdiStringGeneral
in function vdiString1Char
.
The interface for vdiStringGeneral
is already explicit, because it is defined in the same module.
With the declaration you have now, the linker is looking for an external function.
精彩评论