调用DLL函数例子

来源:互联网 发布:creis中指数据城市版 编辑:程序博客网 时间:2024/06/04 18:49
function funMain(inList:PAnsiChar;OutList:PAnsiChar):integer;stdcall;extern 'XX.dll';
 
var
         inList,OutList:PAnsiChar
         Str_InList,Str_Outlist:string;
begin
       GetMem(inList,2048);
       GetMem(OutList,2048);
      try
           inList:='XXOO';
            zeromemory(inList,strLen(inList));
            zeromemory(outList,strLen(OutList));
            strpcopy(str_inList,inList)
            if funMain(inList,outList)<>0 then
            begin
                    showmessage('返回失败!');
                    exit;
            end;
            str_outlist:=strpas(outlist);
            showmessage(str_outlist);
      finally
             freemem(inList);
             freemem(outList);
      end;
end;
原创粉丝点击