DELPHI调用VC写的动态链接库问题
我用VC写了个动态链接库:
t.h:
extern "C" _declspec(dllexport) int caul(int i);
t.cpp
#include "stdafx.h"
#include "t.h"
extern "C" _declspec(dllexport) int caul(int i)
{
return i++;
}
delphi调用:
unit2.pas
unit Unit2;
interface
function caul(i:Integer):Integer; stdcall;
implementation
function caul;external 'd.DLL' name 'caul';
end.
unit1.pas
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
begin
i:=2;
edit1.Text:=inttostr(caul(i));
end;
为什么每次运行的时候都告诉我非法操作啊,哪位知道啊,谢谢拉