Dll调用问题??

Sunniness 2005-01-28 05:44:26
请教一个问题。我用Delphi调用Vc的动态库。在Vc动态库里有一个

int __stdcall InitKey( int com );

语句,我调用它怎么内存出错?

我是这样调用的:
function InitKey(In_Com: Shortint): Shortint; overload; far;External 'KCCardInf.dll'

LabEdt_COMValue.Text := IntToStr(InitKey(1));
...全文
151 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
14174 2005-01-31
  • 打赏
  • 举报
回复
Function 被调函数名(bStatus:bool):integer;stdcall;External '动态连接库名.dll';
这样就可以,如果不对就是你的动态连接库写的不对。
Sunniness 2005-01-31
  • 打赏
  • 举报
回复

////////////////////////////////////////////////////////////////////////////////////////////
// 功能: 获取详细的错误信息
// 输入参数:
// errCode 函数调用时返回的错误代码
// 返回值: 成功 -- 详细的错误信息
// 失败 -- NULL
////////////////////////////////////////////////////////////////////////////////////////////
char* __stdcall GetErrInfo( int errCode, char* errInfo );

delphi调用怎么出错!???
function GetErrInfo(ErrCode: Integer; var ErrInfo: PChar): PChar;
far; stdcall; external 'KCCardInf.dll';
这个函数还是出错??
beyondtkl 2005-01-29
  • 打赏
  • 举报
回复
function InitKey(In_Com: Integer): Integer;external 'KCCardInf.dll' name 'InitKey' stdcall;


找不到:mwrf32.dll,这个动态连接库是系统的还是应用程序的啊!?
// ?? 你自己调用的自己都不清楚? 倒一个..
Sunniness 2005-01-29
  • 打赏
  • 举报
回复
////////////////////////////////////////////////////////////////////////////////////////////
// 功能: 获取详细的错误信息
// 输入参数:
// errCode 函数调用时返回的错误代码
// 返回值: 成功 -- 详细的错误信息
// 失败 -- NULL
////////////////////////////////////////////////////////////////////////////////////////////
char* __stdcall GetErrInfo( int errCode, char* errInfo );


我在delphi 里怎样调用VC的这个涵数;
Sunniness 2005-01-29
  • 打赏
  • 举报
回复
找不到:mwrf32.dll,这个动态连接库是系统的还是应用程序的啊!?
Kshape_zh 2005-01-29
  • 打赏
  • 举报
回复
int __stdcall GetMainPurseInfo( int com, unsigned long* IccID, BYTE* userName, long* balance, short* amount, short* exchangeSn );

我在delphi 里怎样调用VC的这个涵数;
---------------------------------
Function
GetMainPurseInfo(
com :Integer;
IccID:PULONG;
userName:pByte;
balace:pLongint;
amount:pShortint;
exchangeSn:pShortint):Integer;stdcall;
Sunniness 2005-01-29
  • 打赏
  • 举报
回复
up
terrytzq 2005-01-29
  • 打赏
  • 举报
回复
up
Sunniness 2005-01-29
  • 打赏
  • 举报
回复
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// 功能: 取得主钱包的信息
// 输入参数:
// com 串口号 0:com1, 1:com2, 2:com3 ...
// 返回参数:
// IccID IC卡帐号
// userName 用户姓名
// balance 卡片余额
// amount 最后一次消费金额
// exchangeSn 卡片交易流水号
// 返回值:
// 0 成功
// 非0 失败(调用GetErrInfo可以获得详细的错误信息)
//////////////////////////////////////////////////////////////////////////////////////////////////////////
int __stdcall GetMainPurseInfo( int com, unsigned long* IccID, BYTE* userName, long* balance, short* amount, short* exchangeSn );

我在delphi 里怎样调用VC的这个涵数;
Kshape_zh 2005-01-29
  • 打赏
  • 举报
回复
去掉overload,或者用stdcall转换看看可以吗?
function InitKey(In_Com: Shortint): Shortint; far;External 'KCCardInf.dll';

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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