「gfortranでDLL作成」の編集履歴(バックアップ)一覧はこちら
「gfortranでDLL作成」(2008/01/10 (木) 22:03:40) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
*gfortranでDLL作成
gfortran --shared -o hoge.dll hoge.f90
でDLL作成
ちなみにDLLやEXEのチェックに
Dependency Viewer
http://homepage3.nifty.com/super-dacho/
というツールある
>subroutine plus(a,b,c)
>double precision,intent(in) :: a,b
>double precision,intent(out) :: c
>c=a+b
>end subroutine plus
Rでplus.dllを使用したい場合
注意点:subroutineであること
引数の型は強制的に変換する事
>dyn.load("plus.dll")
>plus <- function(a,b){
>.Fortran("plus",
>arg1=as.double(a),
>arg2=as.double(b),
>arg3=double(1)
>)
>}
行列が戻り値の時は、
arg3=matrix(double(4),nrow=2,ncol=2)
とでもする
*gfortranでDLL作成
gfortran --shared -o hoge.dll hoge.f90
でDLL作成
ちなみにDLLやEXEのチェックに
Dependency Viewer
http://homepage3.nifty.com/super-dacho/
というツールある
>subroutine plus(a,b,c)
>double precision,intent(in) :: a,b
>double precision,intent(out) :: c
>c=a+b
>end subroutine plus
Rでplus.dllを使用したい場合
注意点:subroutineであること
引数の型は強制的に変換する事
>dyn.load("plus.dll")
>plus <- function(a,b){
>.Fortran("plus",
>arg1=as.double(a),
>arg2=as.double(b),
>arg3=double(1)
>)
>}
引数が行列の時は
arg1=matrix(as.integer(a),nrow=2,ncol=2)
戻り値が行列の時は、
arg3=matrix(double(4),nrow=2,ncol=2)
とでもする