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

error #8000: There is a conflict between local interface block and external interface block.

Bill1
Beginner
1,243 Views

Hello,

I have created a small example taken from a very large program and am encountering an error #8000:  There is a conflict between local interface block and external interface block.   [INFILE]        C:\DLLtest\RunDLL\RunBatch.for    11    when /warn:interfaces is turned on.  The program seems to run OK with this setting turned off, however, I am trying to track down another problem and am not sure if this problem may be related to the other one or not.

The RunBatch.exe program contains the following interface to USERDLL:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C       DRIVER MODULE TO CALL UserDLL PROGRAM
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      PROGRAM RunBatch
!
      USE DFWIN
!
      IMPLICIT NONE
!
      INTERFACE
        INTEGER(4) FUNCTION USERDLL(INFILE, OUTFILE, IBEG)
!DEC$ ATTRIBUTES DLLIMPORT :: USERDLL
!DEC$ ATTRIBUTES REFERENCE :: INFILE
!DEC$ ATTRIBUTES REFERENCE :: OUTFILE
!DEC$ ATTRIBUTES VALUE :: IBEG
        CHARACTER*(*), INTENT(IN) :: INFILE
        CHARACTER*(*), INTENT(IN) :: OUTFILE
        INTEGER(4) IBEG
        END FUNCTION
      END INTERFACE

The USERDLL.dll contains the following interface:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                       UserDLL PROGRAM
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      INTEGER*4 FUNCTION USERDLL(INFILE, OUTFILE, IBEG)
!DEC$ ATTRIBUTES DLLEXPORT :: USERDLL
!DEC$ ATTRIBUTES REFERENCE :: INFILE
!DEC$ ATTRIBUTES REFERENCE :: OUTFILE
!DEC$ ATTRIBUTES VALUE :: IBEG

I have attached the files used to build the solution, thanks for any advice in locating the problem!

Bill

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,243 Views

The compiler is trying to tell you that the interface for USERDLL you have in RunBatch.for doesn't match that in the actual USERDLL routine. The interface declares INFILE as CHARACTER(*), INTENT(IN), but the actual routine declares it as CHARACTER(260) and no INTENT. These must match. The compiler can see this because /warn:interface is enabled and the generated module from the DLL project is visible to the executable project since it is a project dependency.

The fix isn't quite as simple as declaring INFILE (and OUTFILE?) CHARACTER(*), as you also have ATTRIBUTES REFERENCE for those arguments and that's incompatible with CHARACTER(*).

Before I can tell you how to fix this. you need to tell us why you used ATTRIBUTES REFERENCE here. Is your eventual intent that USERDLL not be a Fortran routine? If so, there are better ways of handling this.

View solution in original post

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
1,244 Views

The compiler is trying to tell you that the interface for USERDLL you have in RunBatch.for doesn't match that in the actual USERDLL routine. The interface declares INFILE as CHARACTER(*), INTENT(IN), but the actual routine declares it as CHARACTER(260) and no INTENT. These must match. The compiler can see this because /warn:interface is enabled and the generated module from the DLL project is visible to the executable project since it is a project dependency.

The fix isn't quite as simple as declaring INFILE (and OUTFILE?) CHARACTER(*), as you also have ATTRIBUTES REFERENCE for those arguments and that's incompatible with CHARACTER(*).

Before I can tell you how to fix this. you need to tell us why you used ATTRIBUTES REFERENCE here. Is your eventual intent that USERDLL not be a Fortran routine? If so, there are better ways of handling this.

0 Kudos
Bill1
Beginner
1,243 Views

Thank you for your reply Steve.  The USERDLL is intended to be a Fortran routine.  RunBatch may be Fortran or C++, although I am using Fortran for test purposes.  I should have seen the differences that you pointed out, and did not realize that ATTRIBUTES REFERENCE is incompatible with CHARACTER(*).  I found that by changing RunBatch code as follows:

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C       DRIVER MODULE TO CALL UserDLL PROGRAM
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      PROGRAM RunBatch
!
      USE DFWIN
!
      IMPLICIT NONE
!
      INTERFACE
        INTEGER(4) FUNCTION USERDLL(INFILE, OUTFILE, IBEG)
!DEC$ ATTRIBUTES DLLIMPORT :: USERDLL
!DEC$ ATTRIBUTES REFERENCE :: INFILE
!DEC$ ATTRIBUTES REFERENCE :: OUTFILE
!DEC$ ATTRIBUTES VALUE :: IBEG
        CHARACTER(260) INFILE
        CHARACTER(260) OUTFILE
        INTEGER(4) IBEG
        END FUNCTION
      END INTERFACE

this example works OK now with /warn:interfaces turned on.  

0 Kudos
Reply