Vc建立lib項目
//Mydll.cpp
#include <stdio.h>
#define Maxx MAXX
#define Minn MINN
extern "C"
{
int Maxx(int a, int b)
{
if(a >= b)return a;
else
return b;
}
int Minn(int a, int b)
{
if(a >= b)return b;
else
return a;
}
}
intel Fortran 調用:
program main !(可要或者不要)
interface
integer function maxx(a,b)
integer a,b
!ms$attributes c,alias:'_MAXX':: maxx
end function maxx
integer function minn(a,b)
integer a,b
!ms$attributes c,alias:'_MINN':: minn
end function minn
end interface
integer aa,bb,cx,cd
aa=12
bb=21
cd=maxx(aa,bb)
cx=minn(aa,bb)
write(*,*)cx,cd
end program