dll中的程序,多线程调用另外一个dll
function OutThread(x:tmyclass): boolean; stdcall;
type mypointer = function(y:tmyclass): boolean; stdcall;
var
     XHandle: Thandle;
     frm_p: mypointer;
begin
          XHandle := loadlibrary(xxx.dll'); ///////此句运行就错,不用多线程时能通过
          if XHandle > 32 then
          try
               frm_p := GetProcAddress(XHandle, 'OutDataFun');
               result := frm_p(x);
          finally
               freelibrary(XHandle);
          end;      
 end;
 
 
function OutData(): boolean;
var 
     hThread: Thandle;
     ThreadID: DWord;begin
     result := false;
     
     try
          hthread := CreateThread(nil, 0, @OutThread, self, 0, ThreadID);
          if hthread = 0 then OutThread(aaa);
     finally
          if hthread > 0 then closehandle(hthread);
     end; 
end;