如果是 Fortran 调用 Fortran,那么非常简单的。都不需要写 stdcall,也不需要 ByValue,也不需要增加 long 。
[Fortran] 纯文本查看 复制代码 Program www_fcode_cn
use Test_mode
Implicit None
Character*30 c , r , s
r = "rr"
s = "ss"
call str_cal_test( r , s , c )
write(*,*) trim(c)
End Program www_fcode_cn
[Fortran] 纯文本查看 复制代码 module Test_Mode
implicit none
contains
subroutine str_cal_test(rr,ss,outp)
!DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"str_cal_test"::STR_CAL_TEST
implicit none
character(*),intent(in) :: rr,ss
character(*),intent(out) :: outp
outp = trim(rr)//trim(ss)
end subroutine
end module
|