1
實際上,我想從fortran中調用岩漿。所以,我添加magma.lib和創建一個接口使用岩漿的C-功用:如何使用Fortran接口調用包含用戶定義類型的C函數
Interface
Integer function magma_dpotrf(uplo, n, a, lda, info) BIND (C, NAME="magma_dpotrf")
use iso_c_binding
Implicit none
!character (c_char), value :: uplo????
integer (c_int), value ::n
real (c_double) ::a(*)
integer (c_int), value ::lda
integer (c_int)::info
end function
end Interface
但參數uplo是一個用戶定義的類型 在C代碼(magma_uplo_t uplo):
typedef enum {
MagmaUpper = 121,
MagmaLower = 122,
MagmaUpperLower = 123,
MagmaFull = 123, /* lascl, laset */
MagmaHessenberg = 124 /* lascl */
} magma_uplo_t;
magma_int_t
magma_dpotrf(
magma_uplo_t uplo, magma_int_t n,
double *A, magma_int_t lda,
magma_int_t *info);
magma_int_t = int,有誰知道如何爲它創建接口? 在此先感謝
它的工作原理!非常感謝。 – user3271438