
C#调用delphi的dll 数据类型出错,求解
delphi语句:functionIntSum(x,y:Integer):Integer;export;beginIntSum:=x+y;end;exportsIntSu...
delphi语句:
function IntSum(x,y:Integer) : Integer ;export;
begin
IntSum := x + y ;
end;
exports IntSum;
begin
end.
C#调用:
[DllImport("DllTest.dll",EntryPoint = "IntSum")]
public static extern int IntSum(int x,int y);
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(IntSum(0,0).ToString());
} 展开
function IntSum(x,y:Integer) : Integer ;export;
begin
IntSum := x + y ;
end;
exports IntSum;
begin
end.
C#调用:
[DllImport("DllTest.dll",EntryPoint = "IntSum")]
public static extern int IntSum(int x,int y);
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(IntSum(0,0).ToString());
} 展开
2个回答
展开全部
function IntSum(x,y:Integer) : Integer ;stdcall;
begin
IntSum := x + y ;
end;
看你的这个函数应该是约定问题了,函数后面加上stdcall就行了,还有一个是,Delphi中函数返回建议使用Result而不建议使用函数返回
begin
IntSum := x + y ;
end;
看你的这个函数应该是约定问题了,函数后面加上stdcall就行了,还有一个是,Delphi中函数返回建议使用Result而不建议使用函数返回
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询