Hi,
I've got an error while compiling this short program using "interface" :
subroutine TEST (*) use, intrinsic :: iso_c_binding implicit none ! ===== Variables ===== logical, save :: MAKE_INIT = .TRUE. logical BRET ! ===== Solver interface ===== interface logical function Init( theDataDir, theWriteStep ) BIND(C, NAME= 1'Init') IMPORT C_INT character, DIMENSION(*) :: theDataDir integer(C_INT) :: theWriteStep end function Init end interface if ( MAKE_INIT ) then write (*,*) 'Init solver...' BRET = INIT( '/u1/home/'//char(0), 100_C_INT ) if ( BRET .EQV. .FALSE. ) then write (*,*) 'Init solver: ERROR ' stop end if write (*,*) 'Init solver: OK' MAKE_INIT = .FALSE. end if RETURN END
I'm using ifort version 12.1.5 with the following compiling line :
ifort TEST.f
I've got the following error message :
TEST.f:(.text+0xc8): undefined reference to `Init'
LD_LIBRARY_PATH points at the correct location. Am I missing something or is it a problem of IFC installation or options ?
Thanks for your help.