首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

调用vc写得dll得有关问题

2012-03-13 
调用vc写得dll得问题我在vc里面写了一个dll文件externC _declspec(dllexport)doublepolyinterp(intlenx,

调用vc写得dll得问题
我在vc里面写了一个dll文件

extern   "C "_declspec(dllexport)   double   polyinterp(int   lenx,int   leny,double   uuu,double   *xxx,double   *yyy,int   a)
{
return   (double)a;
}
在delphi里面写了一个测试得调用dll名字是test.dll
unit   Unit1;

interface

uses
    Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,
    Dialogs,   StdCtrls;

type
    TForm1   =   class(TForm)
        Edit1:   TEdit;
        Edit2:   TEdit;
        Edit3:   TEdit;
        Button1:   TButton;
        procedure   Button1Click(Sender:   TObject);
    private
        {   Private   declarations   }
    public
        {   Public   declarations   }
    end;

var
    Form1:   TForm1;
    function   polyinterp(lenx,leny:Integer;uuu:double;xxx,yyy:array   of   double;uu:Integer):double;cdecl;external   'test.dll ';
implementation

{$R   *.dfm}

procedure   TForm1.Button1Click(Sender:   TObject);
var
    x,y:array   of   double;
   
    i,j,u:Integer;
    ans:double;

begin
    self.Edit1.Text   :=   ' ';
    SetLength(x,5);
    SetLength(y,5);
    for   i:=0   to   Length(x)-1   do
    begin
        x[i]:=i+1;
    end;
    for   j:=0   to   Length(y)-1   do
    begin
        y[j]:=j+1;
    end;
    u:=   5;

          ans:=polyinterp(5,5,4,x,y,8);

   
      self.Edit2.Text:=floattostr(ans);

end;

end.

为什么从   y开始就有问题,居然返回一个很变态得数字,帮忙看看
我分别对c函数离地lenx,leny,uuu,*xxx通过,到了*yyy和a这里就不行了,实在没有办法了希望各位大侠帮忙看看返回得是一个很长得数字。。。

[解决办法]
vc里的double *和delphi里的array of double是等同的吗?
[解决办法]
up
[解决办法]
用array of 定义的动态数组是Delphi特有的数据类型,与VC的 double*不兼容

需换成^double

热点排行