title: Why doesn't control pass to the next instruction after I call a DLL function?
body: <p>I have this function :</p>
  
  <pre><code>procedure call_dll(path:string);
  var
    lib: HMODULE;
    mainfn: procedure(); stdcall;
  begin
  if FileExists(path) then
   begin
   lib := LoadLibrary(PAnsiChar(path));
   Win32Check(lib &lt;&gt; 0);
   try
     @mainfn := GetProcAddress(lib, 'main');
     Win32Check(Assigned(mainfn));
     mainfn();
   finally
     FreeLibrary(lib);
   end;
   end;
  end;
  </code></pre>
  
  <p>this is a function to call a DLL and call a function named <code>main()</code> it works fine but after finish executing the <code>main()</code> function the process still working and using 13.4% from the Processor.</p>
  
  <p>This is when I've call it</p>
  
  <pre><code>showmessage('Test message 1');
  call_dll('Test.dll');
  showmessage('Test message 2');
  </code></pre>
  
  <p>After executing I see the message "Test message 1" and then the message from the DLL function but it still there and do not pass to the third showmessage instruction . <strong>Please I need help</strong></p>