Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
20 Views

BIND (C) clause error

Jump to solution

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

Accepted Solutions
Highlighted
Valued Contributor II
20 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
Highlighted
Valued Contributor III
20 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
Highlighted
Valued Contributor II
21 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
Highlighted
Beginner
20 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
Highlighted
Valued Contributor III
20 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