C#调用FORTRAN的dll时出现了 无法在 DLL“####”中找到名为“###”的入口点的异常
这是fortran程序:FunctionOpenWindSub(path)!DEC$ATTRIBUTESDLLEXPORT::OpenWindSub!DEC$ATTRIB...
这是fortran 程序 :
Function OpenWindSub(path)
!DEC$ ATTRIBUTES DLLEXPORT :: OpenWindSub
!DEC$ ATTRIBUTES ALIAS:'OpenWind_Sub'::OpenWindSub
implicit real*4 (a-h,o-z)
character(len=*)::path
REAL(4) :: Dum_Real
open(11,file='path',form='unformatted',status='old',recl=4,ACCESS='DIRECT')
READ (11,rec=8) Dum_Real
OpenWindSub = Dum_Real
close(11)
end
这是C#:
class openwindfile
{
[DllImport(@"C:\MSDEV\Projects\openwind\Debug\openwind.dll", EntryPoint = "OpenWindSub", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern float OpenWindSub(string path);
}
private void button20_Click(object sender, EventArgs e)
{
string path= "C:\\MSDEV\\Projects\\readwnd\\wind1.wnd";
float WindSpeed;
WindSpeed = openwindfile.OpenWindSub(path); 展开
Function OpenWindSub(path)
!DEC$ ATTRIBUTES DLLEXPORT :: OpenWindSub
!DEC$ ATTRIBUTES ALIAS:'OpenWind_Sub'::OpenWindSub
implicit real*4 (a-h,o-z)
character(len=*)::path
REAL(4) :: Dum_Real
open(11,file='path',form='unformatted',status='old',recl=4,ACCESS='DIRECT')
READ (11,rec=8) Dum_Real
OpenWindSub = Dum_Real
close(11)
end
这是C#:
class openwindfile
{
[DllImport(@"C:\MSDEV\Projects\openwind\Debug\openwind.dll", EntryPoint = "OpenWindSub", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern float OpenWindSub(string path);
}
private void button20_Click(object sender, EventArgs e)
{
string path= "C:\\MSDEV\\Projects\\readwnd\\wind1.wnd";
float WindSpeed;
WindSpeed = openwindfile.OpenWindSub(path); 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询