delphi 调用vc写的dll中的问题

onthorn 2013-02-05 04:22:58
已知vc中的dll的头文件部分如下

_declspec(dllexport) void Sina_GetUidByNickname(char* strContent,char* strUid);

vc中的意思是通过你给一个 用户昵称,然后得到UID,函数是无返回值的,


我在delphi中静态引用dll

type
private
{ Private declarations }
public
{ Public declarations }
end;
function Sina_GetUidByNickname(strContent,strUid:string):integer;cdecl;external 'XXX.dll';

implementation




按钮的过程中我写、

var
uid;
begin
Sina_GetUidByNickname('昵称',Pchar(uid));
ShowMessage(uid);
end;

...全文
145 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Henry.6 2013-02-17
  • 打赏
  • 举报
回复
网上这种例子很多的,我博客里也有
hsfzxjy 2013-02-05
  • 打赏
  • 举报
回复
祝贺了。。。。
onthorn 2013-02-05
  • 打赏
  • 举报
回复
var uid:array[0..9] of Char; p:PChar; i:Integer; s:string; begin New(p); SinaWeiBo_OpenGetUidByNickname('叫兽教你打Dota',p); CopyMemory(@uid[0],p,10); for i:=0 to 9 do begin s := s+uid[i]; end; Edit2.Text := s; Dispose(p); 自己摸索着解决了 SinaWeiBo_OpenLogout; end;
onthorn 2013-02-05
  • 打赏
  • 举报
回复
引用 1 楼 feiba7288 的回复:
function Sina_GetUidByNickname(strContent,strUid: PChar):integer;cdecl;external 'XXX.dll';
加入让你来调用这个dll 你会怎么使用,麻烦您了
onthorn 2013-02-05
  • 打赏
  • 举报
回复
Raised Exception
feiba7288 2013-02-05
  • 打赏
  • 举报
回复
function Sina_GetUidByNickname(strContent,strUid: PChar):integer;cdecl;external 'XXX.dll';

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧