title: typedef does not work with SWIG (python wrapping C++ code)
body: <p>Hello and thanks for your help in advance !</p>
  
  <p>I am writing a python wrapper (SWIG 2.0 + Python 2.7) for a C++ code. The C++ code has typedef which I need to access in python wrapper. Unfortunately, I am getting following error when executing my Python code:</p>
  
  <pre class="lang-none prettyprint-override"><code> tag = CNInt32(0)
     NameError: global name 'CNInt32' is not defined
  </code></pre>
  
  <p>I looked into SWIG documentation section 5.3.5 which explains size_t as typedef but I could not get that working too.</p>
  
  <p>Following is simpler code to reproduce the error:</p>
  
  <h1>C++ header:</h1>
  
  <pre class="lang-cpp prettyprint-override"><code>#ifndef __EXAMPLE_H__  
  #define __EXAMPLE_H__  
  
  /* File: example.h */
  #include &lt;stdio.h&gt;
  
  #if defined(API_EXPORT)
      #define APIEXPORT __declspec(dllexport)
  #else
     #define APIEXPORT __declspec(dllimport)
  #endif
  
  typedef int CNInt32;
  
  class APIEXPORT ExampleClass {
  public:
    ExampleClass();
    ~ExampleClass();  
  
    void printFunction (int value);
    void updateInt (CNInt32&amp; var);
  };
  
  #endif //__EXAMPLE_H__
  </code></pre>
  
  <h1>C++ Source:</h1>
  
  <pre class="lang-cpp prettyprint-override"><code>/* File : example.cpp */
  #include "example.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  /* I'm a file containing use of typedef variables */
  ExampleClass::ExampleClass() {
  }
  
  ExampleClass::~ExampleClass() {
  }
  
  void ExampleClass::printFunction  (int value) {
  cout &lt;&lt; "Value = "&lt;&lt; value &lt;&lt; endl;
  }
  
  void ExampleClass::updateInt(CNInt32&amp; var) {
    var = 10;
  }
  </code></pre>
  
  <h1>Interface file:</h1>
  
  <pre><code>/* File : example.i */
  %module example
  
  typedef int CNInt32;  
  
  %{
      #include "example.h"
  %}
  
  %include &lt;windows.i&gt;
  %include "example.h"  
  </code></pre>
  
  <h1>Python Code:</h1>
  
  <pre class="lang-python prettyprint-override"><code># file: runme.py  
  from example import *
  
  # Try to set the values of some typedef variables
  
  exampleObj = ExampleClass()
  exampleObj.printFunction (20)
  
  var = CNInt32(5)
  exampleObj.updateInt (var)
  </code></pre>
  
  <p>Thanks again for your help.</p>
  
  <p>Santosh</p>