函数里有一个type类型,我是不是要在delphi里再重新定义一个这种类型才行?
能不能给个例子

解决方案 »

  1.   

    数据类型定义,在执行程序和动态链接库中都加以定义
    type
    Pdattyp=^Tdattyp;
    Tdattyp=record
    dat1:dword;
    dat2:integer;
    end;在动态链接库里
    procedure testcord1(var dattyp:Tdattyp);stdcall;
    begin
    dattyp.dat1:=100;
    dattyp.dat2:=-5;
    end;procedure testcord2(dattypp:Pdattyp);stdcall;
    begin
    dattypp^.dat1:=200;
    dattypp^.dat2:=-11;
    end;
    在程序里procedure test();
    var
    dattyp:Tdattyp;
    begin
    testcord1(dattyp);
    showmessage(inttostr(dattyp.dat1)+'|'+inttostr(dattyp.dat2));
    testcord2(@dattyp);
    showmessage(inttostr(dattyp.dat1)+'|'+inttostr(dattyp.dat2));
    end;