title: How to access value of struct that only has pointer typedef with SWIG/Python
body: <p>I am creating a Python wrapper for an existing code base with a DLL and header.  I am using SWIG.</p>
  
  <p>The code base has multiple struct pointer defs like so:</p>
  
  <pre><code>typedef struct session* session_t;
  </code></pre>
  
  <p>In this example, <code>session</code> is not defined anywhere else.  All other functions in the DLL take <code>session_t</code> as an input. If I try and reference <code>session</code> anywhere in SWIG generated code I get compile errors that <code>session</code> is not defined.  I need a way to access the value of <code>session_t</code> in Python code.</p>
  
  <p>I've tried using cpointer.i and pointer_functions macro, but this doesn't work since it assumes the input type is not a pointer.</p>
  
  <p>I thought if I could redefine the struct:</p>
  
  <pre><code>typedef struct Session {} session, *session_t;
  </code></pre>
  
  <p>This could work, but I cant find a way to do this with SWIG.</p>
  
  <p>Is there a way to access the value of a struct pointer with SWIG if it's only definition is a typdef struct pointer?</p>
  
  <p>Edit:  possible fix is the SWIG <code>%ignore</code> directive.  Might be able to ignore the original struct def and replace it in the .i file.</p>
  
  <p>Solved(ish): I marked Mark Tolonen's answer as correct since it has a lot of useful relevant information.   The API I'm trying to wrap has a lot of deleted constructors and behaviors locking down how it's used.  I ended up writing a C++ wrapper in it's own namespace then telling Swig to ignore everything except my namespace.  I then only use standard or my own types to interface with Swig/Python.   </p>