需要传递一个数组该怎么实现呢?
vc的dll如下定义
 extern "C" _declspec(dllexport)   double aaa(double aa[];int count);
请问在 delphi中如何,定义和调用呢?最好给源码

解决方案 »

  1.   

    // Delphi 下的声明为:
    function aaa(aa: PDouble; count: Integer): Double; cdecl;// 调用的例子
    var
    intNo: Integer;
    pValue: PDouble;
    strList: String;
    begin
    if aa = nil then
    exit;pValue := aa;
    strList := '';
    for intNo := 0 to count - 1 do
    begin
    strList := strList + ', ' + FormatFloat('0.######', pValue^);// 指向下一项
    Inc(pValue);
    end;// 去除前面的 ", "
    if strList <> '' then
    Delete(strList, 1, 2);// 显示
    ShowMessage(strList);
    end;
      

  2.   

    例子写错了!// 调用的例子
    var
    arrValues: array[0..255] of Double;
    doubValue: Double;
    begin
    // ??? ... ...
    doubValue := aaa(arrValue, 5);
    end;