title: Swig and PHP: C function expects enum as argument
body: <p>I have a c function that looks like this: </p>
  
  <pre><code>GetCurrentMode(RADIOMODES *radioModes); 
  </code></pre>
  
  <p>And both my .h file and swigs .i file contain these enum definition: </p>
  
  <pre><code>typedef enum _RADIOMODES { 
          RADIOMODES_NONE     = 0, 
          RADIOMODES_ONE  = 1, 
          RADIOMODES_TWO    = 2, 
  } RADIOMODES; 
  </code></pre>
  
  <p>GetCurrentMode should set $rcs to the correct mode.
  But when I run:</p>
  
  <pre><code>$rcs = RADIOMODES_NONE;
  GetCurrentMode($rcs); 
  </code></pre>
  
  <p>I get these error: 
  PHP Fatal error:  Type error in argument 1 of GetCurrentMode. Expected SWIGTYPE_p__RADIOMODES</p>
  
  <p>How do I get swig and php to set $rcs to the correct enum? 
  Or how do I get swig to convert enum RADIOMODE to int and back?</p>
  
  <p>SOLVED:
  Issue was I needed to add a pointer function after my .h file was defined.</p>
  
  <pre><code>%pointer_functions( RADIOMODES, RADIOMODESp )
  </code></pre>
  
  <p>This added several new functions that I can use in PHP.</p>