在DLL中函数返回值不要用strings,最好使用PChar。
解决方案 »
- 关于VarIsNull,VarIsEmpty
- Image调用图片的方法
- 惊天大发现,四个棱的钥匙尖可以当螺丝刀用,赞自己一个
- 问个报表的问题.
- How to install Delphi 5.0 or Delphi 5.5 at windows2000?
- 这段代码怎么运行不了?
- 一个SQL问题???很急!!!!!!!!!!!
- 怎样给程序定义热键?
- 我原来在简体的SQL SERVER数据库Collation name是Chinese_PRC_CI_AS,现要转为繁体使用,如何将Collation name转为Chinese_Taiwan_Stroke
- 加数字签名
- 急(给高分)
- 字体大小设置问题,请各位高手帮忙
要么就加单元sharemem
library test;//test.dll
uses
SysUtils,
Classes;
{$R *.RES}
function returnresult(value:integer):string;stdcall;
begin
case value of
1:result:='優秀';
2:result:='優良';
3:result:='良好';
4:result:='及格';
5:result:='不及格';
else
result:='錯誤!';
end;
end;
exports
returnresult index 1;
begin
end.
-----------------------------
我按下button1就出现'Invalid pointer operation'错误.代码如下:
-----------------------------
implementation
function returnresult(value:integer):string;stdcall external 'test.dll';
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Lines.Add('你的成績:'+returnresult(3));
end;
end.
----------------------