title: Forwarding data in a DLL
body: <p>I need to forward a set of symbols from one DLL to another (to support some versioning scheme, <a href="http://www.python.org/dev/peps/pep-0384/">PEP 384</a> if you wonder). It works fine for functions; I write a module definition file, saying</p>
  
  <pre><code>LIBRARY "python3"
  EXPORTS
    PyArg_Parse=python32.PyArg_Parse
    PyArg_ParseTuple=python32.PyArg_ParseTuple
    PyArg_ParseTupleAndKeywords=python32.PyArg_ParseTupleAndKeywords
  [...]
  </code></pre>
  
  <p>However, it fails for data. If I say</p>
  
  <pre><code>PyBaseObject_Type=python32.PyBaseObject_Type
  </code></pre>
  
  <p>then the linker complains that PyBaseObject_Type is an unresolved symbol, even though it actually is exported from python32.dll. Looking at the import library, I notice that, for data, there is only the <code>_imp__</code> symbol, so I tried</p>
  
  <pre><code>PyBaseObject_Type=python32._imp__PyBaseObject_Type
  </code></pre>
  
  <p>The linker does actually create a DLL now, however, in this DLL, the forwarding goes to the <code>_imp__</code> symbol, which then cannot be resolved at runtime. I also tried putting DATA into the line (with or without the <code>_imp__</code>); this doesn't make a difference.</p>
  
  <p>IIUC, forwarding data should work fine, since the data is declared as <code>__declspec(dllimport)</code> for any importer of the DLL, so the compiler should interpret the reference correctly.</p>
  
  <p>So: How can I generate a DLL that does data forwarding?</p>