另外,dllmain什么时候被调用?
reference+1的时候,还是reference=1的时候?于dllmain对应的结束dll引用的时候系统调用的是什么函数?这些和initialization,finalization的关系是什么?

解决方案 »

  1.   

    关注!我也有同样的问题。delphi中的dllmain究竟应该怎样实现啊?
      

  2.   

    library Test;
    var  SaveExit: Pointer;procedure LibExit;begin
      ...  // library exit code
      ExitProc := SaveExit;  // restore exit procedure chain
    end;begin  ...  // library initialization code
      SaveExit := ExitProc;  // save exit procedure chain
      ExitProc := @LibExit;  // install LibExit exit procedure
    end.
    以上代码引自delphi的帮助
      

  3.   

    是不是说dll的begin..end就是dllmain的begin..end呢?那么dllmain的参数如何得到呢?
      

  4.   

    dllmain的参数可通过以下几个全局变量得到
    1、TDLLProcEx = procedure (Reason: Integer; Reserved: Integer);
    DllProcEx: TDLLProcEx;{Points to a procedure invoked by a DLL entry point.}2、HInstance: LongWord;          { Handle of this instance }
      

  5.   

    <<delphi开发人员指南>>246
    procedure DllEntryPoint(dwReason: DWORD);
    begin
      case dwReason of
        DLL_PROCESS_ATTACH: ShowMessage('Attaching to process');
        ...
      end;
    end;begin
      DllProc := @DLLEntryPoint;
      DllEntryPoint(DLL_PROCESS_ATTACH);
    end;我这是delphi update pack 2
    不打补丁就不好使