1.首先delphi的string和别的语言不兼容,一般delphi中必须将参数声明为pchar(别的语言则传递字符串指针,或者按地址传参数)
2.delphi的UNIT引用里千万不能带上sharemem
3.delphi的参数类型只能是一般的,不能是var之类的
4.函数的声明必须是带有stdcall;export;
实例:
unit dlltest;
interface
uses sysutils,Dialogs;
procedure tostr(i:pchar);stdcall;export;
implementation
procedure tostr(i:pchar);
begin
showmessage(i);
end;
end.
博客介绍了Delphi与其他语言交互时DLL开发的要点。包括Delphi的string与其他语言不兼容,需将参数声明为pchar;UNIT引用里不能带sharemem;参数类型只能是一般的;函数声明要带有stdcall和export,并给出了实例。
1083

被折叠的 条评论
为什么被折叠?



