C++与delphi的record 之间的数据对应问题!(80分)

S

ssf0706

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在在用C++做了一个dll,其返回值是结构数组。 现在用delphi进行调用,请问一下:delphi中用什么可以将返回的结构数组的值保存下来。能不能请高手写个实例给哦看下!
在delphi中怎么声明 这个调用的函数呢?
我C++ 中的函数是这样声明的:
extern "C" DllExport struct MemoryData BufferDataProcedure(char *myfilename,struct MemoryData temp)
那delphi中改如何去做,才可以调用这个函数,并保存下调用得到的结果!
 
type
MemoryData=record
///形式我不知道
end;
function bufferdataprocedure(myfilename :pchar;temp:memeorydata):memorydata;
我不大会C++,你看看这样是不是啊。。。
 
楼上
是对的
 
unit mytestDll;
interface
type
MemoryData=record
.......
end;
function BufferDataProcedure(myfilename:pChar):MemoryData;
stdcall;
implementation
function BufferDataProcedure:MemoryData;
external 'NCInterpreterDLL.dll';
end.

这样调用dll行吗?
我试了一下 不行的!
出现这样的错误:
[Error] mytestDll.pas(52): Previous declaration of 'BufferDataProcedure' was not marked with the 'overload' directive
[Error] mytestDll.pas(48): Unsatisfied forward or external declaration: 'BufferDataProcedure'
说明一下:dll的接口函数改成这样了。
extern "C" DllExport struct MemoryData BufferDataProcedure(char *myfilename)
 
有时需要packed....
 
顶部