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

How do I create C/C++ function prototypes from a F90 code/ module

carlls
Beginner
538 Views
Greetings:

I know how to create a mod file from C function prototypes, but how do I go the other way..... say I have:

MODULE MySqrt_API


INTERFACE MySqrt
MODULE PROCEDURE MySqrt_s
MODULE PROCEDURE MySqrt_d
END INTERFACE

CONTAINS

SUBROUTINE MySqrt_s(X, X_ROOT)
IMPLICIT NONE
REAL (KIND=4), INTENT(IN) :: X
REAL (KIND=4), INTENT(OUT) :: X_ROOT

print *, 'Calling real*4 sqrt'
X_ROOT= SQRT(X)
RETURN
END SUBROUTINE MySqrt_s


SUBROUTINE MySqrt_d(X, X_ROOT)
IMPLICIT NONE
REAL (KIND=8), INTENT(IN) :: X
REAL (KIND=8), INTENT(OUT) :: X_ROOT

print *, 'Calling real*8 sqrt'
X_ROOT= DSQRT(X)
!X_ROOT= SQRT(X)

RETURN
END SUBROUTINE MySqrt_d


END MODULE MySqrt_API


What does the function prototype for C look like to get to MySqrt_d and MySqrt_s? And is this a portable solution under IF 9.1 and or IF 11.

By the way the C/C++ will be Microsofts .... still want that debugger :)

Thanks
Carl

0 Kudos
0 Replies
Reply