title: delphi finalizalization code in a DLL
body: <p>I am moving some functions to a shared DLL (I want to have some called as a Windows hook).</p>
  
  <p>The actual functions are currently in a <code>unit</code>, and it happens to have some <code>initialization</code> and some <code>finalization</code> code.</p>
  
  <p>I was initially thinking on doing a direct transformation from a <code>unit</code> to a <code>library</code>. So I  moved the <code>initialization</code> code in between the main <code>begin</code> and <code>end.</code>. But then I realized I had no place to move the <code>finalization</code> code. I should create and register an special DLL entry point, instead.</p>
  
  <p>My question is. Can I leave the <code>unit</code> with all the functions and the <code>initialization</code> and <code>finalization</code> codes and just create a <code>library</code> stub that <code>uses</code> the unit?  will the <code>finalization</code>it be called? </p>