调用VC写的DLL出现问题

xhd80 2008-09-04 10:52:29
VC写的DLL中有如下三个内容::

3. Search IC:
int WINAPI Inventory(uc8* buf,us8 &count,us8 timeout);
uc8 buf[128];
us8 cnt = 5;
ret = _Inventory(buf,cnt,500);//Timeout500
The cnt is IC Count while return OK, ID length is 8 and ID has been save to buf

4. Read Simply Block:
int WINAPI ReadSingleBlock(uc8* buf,byte block,us8 opmode);
Description:
Block: block index of IC //0~63
Opmode: mode of operate
Use:
if(mode == AddressMode)
{
uc8 dat[ID_LENGTH];
..//ID length is 8
ret = _ReadSingleBlock(dat,0,mode);
if(ret==RET_OK)
{
Recive block data to dat, the data length is SINGLE_BLOCK_SIZE//
}
}
else
{
uc8 dat[SINGLE_BLOCK_SIZE];
memset(dat,0,SINGLE_BLOCK_SIZE);
ret = _ReadSingleBlock(dat,cmbBlock->ItemIndex,mode);
if(ret==RET_OK)
{
//other
}
}

5. Write simply Block:
int WINAPI WriteSingleBlock(uc8* id,uc8* buf,byte block,us8 opmode);
Description:
Id: IC 的ID
Block: block index of IC //0~63
Opmode: mode of operate
Use:
us8 mode = … ;
if(mode == AddressMode)
{
uc8 id[ID_LENGTH];
uc8 dat[ID_LENGTH];
memset(id,0,ID_LENGTH );
memset(dat,0,SINGLE_BLOCK_SIZE);
ret = _WriteSingleBlock(id,dat,block,mode); //need ID
}
else
{
uc8 dat[SINGLE_BLOCK_SIZE];
memset(dat,0,SINGLE_BLOCK_SIZE);
HexToBin2(edtData->Text,dat);
ret = _WriteSingleBlock(NULL,dat, block,mode); // needlessness ID

}


请问在delphi中怎么调用啊???????????
...全文
57 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xhd80 2008-09-05
  • 打赏
  • 举报
回复
#define uc8 unsigned char
#define us8 unsigned short
#define ul32 unsigned long
fangsp 2008-09-05
  • 打赏
  • 举报
回复
先帮楼主顶一下
shuihan20e 2008-09-04
  • 打赏
  • 举报
回复
数据类型对照着
老之 2008-09-04
  • 打赏
  • 举报
回复
不清楚uc8和us8是什么类型,可能是unsigned char和unsigned short
试试这么定义这几个函数

function Inventory(buf: PByte; var count: Word; timeout: Word): Integer; stdcall; external 'xxx.dll';
function ReadSingleBlock(buf: PByte; block: Byte; opmode: Word): Integer; stdcall; external 'xxx.dll';
function WriteSingleBlock(id: PByte; buf: PByte; block: Byte; opmode: Word): Integer; stdcall; external 'xxx.dll';

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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