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

BIND (C) clause error

Jean_Paul_L_
Beginner
377 Views

Hello,

I upgraded the IVF Compiler to 17.0.5.267 and now one of my projects won't compile. I get the following error: "Error: A dummy procedure must not be specified with a NAME=Specifier".

My code is doing using the BIND (c) clause just like this: SUBROUTINE CSub () BIND(C, NAME="CSub)

​Is there a new way of doing this in this compiler version? Sorry if the question doesn't make much sense. I am fairly new to Fortran :)!

 

0 Kudos
1 Solution
JVanB
Valued Contributor II
377 Views

It seems to me that this is likely due to an interface body declaring a dummy subroutine Csub. A nicer way to declare it, if possible, would be to USE the module containing CSub and declare the corresponding dummy argument via the PROCEDURE statement

USE M, only: CSub_paradigm => CSub
implicit none
procedure(CSub_paradigm) CSub

If this is not feasible, just delete the NAME= clause from the interface body that declares dummy argument CSub.

 

View solution in original post

0 Kudos
4 Replies
andrew_4619
Honored Contributor II
377 Views

Well your example shown has an error as you have "csub not "csub" maybe that is a typing error. It is much better to cut an paste some real and more complete code in a fortran box using the {code } tool like below. It will be easier to help then.  

subroutine fred()
   implicit none
   print *, 'hello world'
end subroutine fred

 

0 Kudos
JVanB
Valued Contributor II
378 Views

It seems to me that this is likely due to an interface body declaring a dummy subroutine Csub. A nicer way to declare it, if possible, would be to USE the module containing CSub and declare the corresponding dummy argument via the PROCEDURE statement

USE M, only: CSub_paradigm => CSub
implicit none
procedure(CSub_paradigm) CSub

If this is not feasible, just delete the NAME= clause from the interface body that declares dummy argument CSub.

 

0 Kudos
Jean_Paul_L_
Beginner
377 Views

Yes it seems that this error is due to the interface body declaring a dummy subroutine. I am guessing this was allowed in older versions of the compiler?

		SUBROUTINE SETCALLBACKFUNC(TESTFUNC) BIND(C,NAME="SETCALLBACKFUNC")
      	IMPLICIT NONE
      	INTERFACE
      	INTEGER FUNCTION TESTFUNC (arg, arg2) BIND(C,NAME="TESTFUNC") 
      	IMPLICIT NONE
      	INTEGER :: arg
      	CHARACTER, DIMENSION(*) :: arg2
      	END FUNCTION TESTFUNC
      	END INTERFACE
      	END SUBROUTINE SETCALLBACKFUNC

 

0 Kudos
andrew_4619
Honored Contributor II
377 Views

You surely wouldn't want the name= on the interface as you would expect the interface to be generic? Maybe (untested) you mean something like...

      subroutine action( sub, a, b) bind(C, name='fred') 
        implicit none
        integer, intent(in)    ::  a, b
        procedure(sub_example) :: sub
        abstract interface
            subroutine sub_example(aa, bb) bind(c)
                integer,intent(in) :: aa, bb
            end subroutine
        end interface
        call sub(a,b)       
    end subroutine action

Which is a variation on what RO suggested.

0 Kudos
Reply