一個FORTRAN interface
成C使用extern
我應該如何導入?輸入接口模塊規程,從FORTRAN成C
假設我有以下FORTRAN模塊:
!swapper module
module swapper
interface swap
module procedure swap_r, swap_i, swap_c
end interface
contains
!subroutine implementations here:
!swap_r takes two double precision as argument
!swap_i takes two integers as argument
!swap_c takes two characters as argument
end module swapper
然後可我只是做在C,以下?
extern "C" void __swapper_MOD_swap(double*, double*)
extern "C" void __swapper_MOD_swap(int*, int*)
extern "C" void __swapper_MOD_swap(char*, char*)
或者,如果我答應打電話swap
只有雙精度數,我可以完全做到這一點?
extern "C" void __swapper_MOD_swap(double*, double*)
也許這可以幫助您,http://docs.cray.com/books/S-2179-52/html-S-2179-52/ppgzmrwh.html。 – Stargateur
C中沒有泛型,但在C++中有泛型。 C中沒有'extern「C」''你實際使用C++嗎? –
這裏有更多關於'INTERFACE'的信息:https://people.sc.fsu.edu/~jburkardt/f_src/f90_calls_c++/f90_calls_c++。html – QuantumDot