我写了一个dll
代码是function a:integer;stdcall;
      begin
       result:=2;
      end;
     exports
     a;
在程序中静态调用没错,但改为
function a:string;stdcall;
begin
result:='fg';
end;exports
a;
在程序中静态调用有错误,把stdcall改成export也有错
请问怎么回事

解决方案 »

  1.   

    问题问得好怪你眼睛多少度不会有  1000  度吧
    string 改为 Integer;
      

  2.   

    因为string不同于integer.属基本数据类型。而string则是delphi中才出现的特殊类型。不同于windows.所以在dll中会出错。可考虑加上sharemem.pas.来解决这种问题。
      

  3.   

    在uses 中加上sharemem
    { Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }
    要么换成pchar类型好了
      

  4.   

    在用的话得在dll的第个文件中的uses的第一个加上ShareMem