刚接触,遇到这个警告,请各位高手指教,谢谢,源码如下:
library ChuShiHua;{ 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. }uses
  ShareMem,
  SysUtils,
  windows,
  Classes;
  function  Initial():integer;stdcall;
       var  buf:PChar;
       begin
       buf:='EB 90 82 00 00 00 00 00 00 00 00 00 00 00 00 00';
       if Length(buf)=16 then
       result:=0;
    end;{$R *.res}
exports
   Initial;begin
end.

解决方案 »

  1.   

    function Initial():integer;stdcall;export;
      

  2.   

      if Length(buf)=16 then
      result:=0;这句if不满足的话就没有返回值了
      

  3.   

    function Initial():integer;stdcall;
    var
      buf:PChar;
    begin
      Result := 1;
      buf:='EB 90 82 00 00 00 00 00 00 00 00 00 00 00 00 00';
      if Length(buf)=16 then
        result := 0;
    end;或者function Initial():integer;stdcall;
    var
      buf:PChar;
    begin
      buf:='EB 90 82 00 00 00 00 00 00 00 00 00 00 00 00 00';
      if Length(buf)=16 then
        result := 0
      else
        Result := 1;
    end;顺便说一句,养成良好的代码书写习惯,对人对己都很重要。