你这个代码好绕啊,错误也很多。你想实现什么?我改了一下,但不知是否和你意?[Fortran] 纯文本查看 复制代码 module tts
Use ISO_C_BINDING
Implicit none
Integer(c_int) , pointer :: pt
contains
subroutine ts( ats ) Bind( C )
type(c_ptr),value ::ats
call c_f_pointer( ats , pt ) !// 把 C 语言的指针 ats 转换成 fortran 的指针 pt
print *,'pt=',pt
End subroutine ts
End module tts
!********************************************
!********************************************
program main
use ISO_C_BINDING
use tts
Implicit none
Interface
subroutine ss(as) bind(C,name = 'ss_' )
import
type(c_funptr),value ::as
End subroutine ss
End Interface
call ss( c_funloc(ts) )
End Program Main [C] 纯文本查看 复制代码 #include <stdio.h>
void ss_(void *as){
printf("s=%p\n",as);
}
|