拜托问,执行到第一个end时报内存错误是什么原因呢?
library USEME;{ 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,
  Classes,
  Ulogic in 'Ulogic.pas',
  Unit3 in 'Unit3.pas' {Dm: TDataModule};{$R *.res}function Usemeobj: Tuser;
begin
   Result:=Tuser.Create;
end;-------------报错//begin
exports
  Usemeobj;
end.

解决方案 »

  1.   

    Project D:\p\mycode\proj\oopcode-maint1\Project1.exe faulted with message :'access violation at 0x73755405: read of address 0x73755405'.Process Stopped.Use Step or Run to continue.
    thanks
      

  2.   

    可能是VCL内部的错误吧。。前一段我也遇到过。。单步跟踪没错或是到END时报错。
    你跟踪一下VCL内部的了些代码吧,可能会找到问题所在。不过大部分还是自己的错,最好把你代码多贴出来一些,大家看看。
      

  3.   

    你的begin和end 配对了吗?
    找个.dll的例子see see
      

  4.   

    多谢大家关注,我是因为改写代码想把一个对象放在dll里遇到问题的.
    现在打算全部重写看看.构造函数里空空的啥也没有.
    虽然我坚信是自己的问题不过
    --'你跟踪一下VCL内部的了些代码吧,可能会找到问题所在。'
    --该怎么看呢是研究那些汇编指令吗?
      

  5.   

    刚才简单重写了一个调试时可以运行但退出时会报错:
    Project P1.exe raised exception class ESocketError with with message 'Windows socket error:可能是应用程式尚未呼叫
    WSAStartup' 或WSAStartup发生失败.(10093),on API'closesocket".Process stopped. Use Step or Run to coontinue.
    若编译成exe执行退出时不会报错.会是什么原因造成的呢?
    -------************form 代码:
    unit Uman;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons,Uuseri;type
     { Tuser = class(Tobject)
      public
        function WipQuery(sn: string):string; virtual; abstract;
      end;}  TForm1 = class(TForm)
        BitBtn1: TBitBtn;
        Edit1: TEdit;
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
      public
           { Public declarations }
      end;var
      Form1: TForm1;
      function UserA :ijack; external 'useme.dll';
    implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
    var kk:ijack;
    begin
      kk:=usera;
      edit1.Text:=kk.WipQuery('');
     // usera.Free;
    end;end.
    *********************dll********
    library useme;{ 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
      SysUtils,
      Classes,
      Udm in 'Udm.pas' {DataModule2: TDataModule},
      Ulogic in 'Ulogic.pas',
      Uuseri in 'Uuseri.pas';{$R *.res}function UserA: ijack;
    begin
      UserA := Tuser.create;
    end;exports
      UserA;
    end.************************interface*************
    unit Uuseri;interface
    type
      Ijack= interface(Iinterface)
        ['{3EC3FDBF-D41E-47DE-B455-816A8765B374}']
        function wipquery(sn:string):string;
      end;
    implementationend.