title: SWIG C++ structure to java
body: <p>I'm trying to get a simple SWIG example to work that uses a struct as a return type, but my generated file is incorrect. My files look like this.</p>
  
  <pre><code>SwigTest.h
  #pragma once
  #include "MyHeader.h"
  class SwigTest
  {
  public:
      MyHeader testMe();
  };
  
  MyHeader.h
  struct MyHeader {
      int x;
  }
  </code></pre>
  
  <p>and my swig interface file is:</p>
  
  <pre><code>%module MyModule
  %{
  #include "SwigTest.h"
  #include "MyHeader.h"
  %}
  extern MyHeader testMe();
  </code></pre>
  
  <p>The resulting JNI file has the following method declaration</p>
  
  <pre><code>public class MyModuleJNI {
    public final static native long testMe();
  }
  </code></pre>
  
  <p>If my method returns a primitive, it works fine, but not with the struct. I'm running on windows with <code>swig.exe -java -c++ MyModule.i</code></p>
  
  <p>EDIT: I think I need to declare a struct in the .i file as well. Could someone confirm (or dispute) that? Thanks.</p>
  
  <p>thanks,
  Jeff</p>