title: Export a global symbol from a Delphi DLL
body: <p>I'm trying to create a Gecko 2.0-compatible DLL in Delphi.</p>
  
  <p>Previously (pre-Gecko 2.0) the DLL needed to export a NSGetModule() function. This worked flawlessly.</p>
  
  <p>Starting with Firefox 4, my DLL is getting loaded (I have verified this though a breakpoint in my initialization section), but my NSGetModule() function does not get called anymore. This is the designed behavior because starting with Gecko 2.0 (Firefox 4), a binary component is not supposed to export a NSGetModule() function:</p>
  
  <p><a href="https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0#Binary_components" rel="nofollow noreferrer">https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0#Binary_components</a></p>
  
  <p>According to these docs, my DLL needs to export a NSModule data symbol which points to a struct. In Delphi terminology, I assume this is a global variable which points to a Delphi record.</p>
  
  <p>In C++, this is how you export the (global) data symbol:</p>
  
  <pre><code>define NSMODULE_DEFN(_name) extern "C" NS_EXPORT mozilla::Module const *const NSModule
  </code></pre>
  
  <p>My question: how do I accomplish this in Delphi? How do I export a global variable?</p>
  
  <p>I appreciate your feedback.</p>