title: SWIG: difference between %import and %include
body: <p>The <a href="http://www.swig.org/Doc2.0/Preprocessor.html">SWIG docs</a> explain these two directives as follows:</p>
  
  <ul>
  <li><p><code>%include</code>: "To include another file into a SWIG interface, use the <code>%include</code> directive ... Unlike, <code>#include</code>, <code>%include</code> includes each file once (and will not reload the file on subsequent <code>%include</code> declarations). Therefore, it is not necessary to use include-guards in SWIG interfaces."</p></li>
  <li><p><code>%import</code>: "SWIG provides another file inclusion directive with the <code>%import</code> directive ... The purpose of <code>%import</code> is to collect certain information from another SWIG interface file or a header file without actually generating any wrapper code. Such information generally includes type declarations (e.g., typedef) as well as C++ classes that might be used as base-classes for class declarations in the interface. "</p></li>
  </ul>
  
  <p>My question is what are the differences between these two directives and what are the pros/cons of using each?</p>
  
  <hr>
  
  <p>P.S. Just for some background info. I have a simple C++ - python extension that builds and works when I use either of the above directives. One, however (<code>%import</code>) gives fewer warnings when I call <code>swig -c++ -python my_file.i</code>. </p>