输出函数接口export
  kkk;

解决方案 »

  1.   

    没有指明参数调用类型  function kkk: String;stdcall; external 'Func.dll';
      

  2.   

    function kkk: String;stdcall; external 'Func.dll';
    我试了还是出错!
      

  3.   

    export
      function kkk: String;stdcall;
      

  4.   

    copy_paste(木石三):难道不能用String吗?
      

  5.   

    要用string 的话,就要在uses的地方第一个调用shellmem单元
    如果你是用dllwizard建立的DLL文件,就可以在源码中看到这段注释{ 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. }
      

  6.   

    DLL文件: Func.dll
    function kkk: PChar;stdcall;implemetation
    function kkk: PChar;
    begin
      Result:='1234';
    end;调用时:
      function kkk: PChar;stdcall; external 'Func.dll';
      

  7.   

    raiden(什么都不会):还是不行!!!/*************dll source*****************/
    library Project1;uses
      ShareMem, SysUtils, Classes;{$R *.res}function kkk: String;
    begin
      Result:='1234';
    end;exports
      kkk;begin
    end.
    /******************************/
    /*************调用源程序*****************/
    unit Unit1;interfaceuses
      ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      function kkk: String; external 'Project1.dll';implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      caption:=kkk;
    end;end.
    /******************************/
      

  8.   

    在你原程序的interface 下边加上:
    function  kkk:pchar; 
      

  9.   

    哦,更正一下,你用的是静态调用,不用上面说的那样做!这样,你把你源程序中的   
     function kkk: String; external 'Project1.dll';
    放到 implementation 的下边!
      

  10.   

    把在dll中的函数原形的string也改成pchar
    即都使用pchar而非string!
      

  11.   

    使用String[200]试一试。我觉得应该有用
      

  12.   

    function kkk:Pchar ;
    begin
      Result := Pchar('12345...');
    end;**************************************
    function kkk: Pchar; external 'Project1.dll';Caption := kkk ;这样可以的