求助:这个参数如何传递(应该不难哦)(80分)

J

jindgu

Unregistered / Unconfirmed
GUEST, unregistred user!
函数封装在dll中,sdk中说明如下:
在c/c++中声明如下:function(..,void *pwbuffer,..);
sdk上说该参数意思为:the starting address of the momery to contain the data.
在c/c++中,只要定义一个数组:short buff[1000];然后function(..,buff,..);就可以了。
但是在delphi中声明如下:function(..,var buffer:word,..);
当我定义一个数组变量buff:array[0..999] of smallint 或指针 buff:psmallint时,该怎么写这个参数呢?
我写成function(..,@buff,..);但提示说实际参数和var 参数的类型不一样。
那位大虾指点小弟一二,不胜感激!
 
自己顶一下,大虾们帮帮忙哦
 
function(varName: array of smallint)
 
word,smallint 改成 Integer试试
 
我感觉上面两位没有理解我的意思。
zbr的意思是让我改原来的声明?但是我现在就是不想改这个。
我想知道该如何定义一个缓冲区,再赋给var buff这个变量!
9607gfg完全不是你说的那个问题。3x 依然!
 
如果BUFFER,是指针,就写BUffer^
如果是数组, 就写Buffer[0]
 
(c/c++ -----> void *) == (delphi ------> pointer)
 
to allenzen
你说的两种方法我也试过和我用@buff提示的错误是一样的。Types of actual and formal var parameters must be identical.
to oldwry
你说的这个我也明白,关键是它本身定义好了是 word类型。如果定义是pointer的话我就不必问大家了。
 
没人知道怎么弄吗?
 
在c/c++中声明如下:function(..,void *pwbuffer,..);
但是在delphi中声明如下:function(..,var buffer:word,..);
=========================
为什么要声明成var buffer: word;
????
void * pwbuffer --> function (...;
buffer: Pointer ;...);
 
多人接受答案了。
 
顶部