SWIG general questions
<p>I'm learning SWIG and I'm trying to understand some c++ possible situations which i haven't been able to figure out after looking the docs&amp;examples, here's my content:</p>

<p>usecase1.h</p>

<pre><code>#ifndef __USECASE1_H__
#define __USECASE1_H__

namespace foo_namespace {
    int usecase1_f1( float b, float c, float *res );
}

#endif
</code></pre>

<p>usecase1.cpp</p>

<pre><code>int usecase1_f1( float b, float c, float *res )
{
    return 1;
}
</code></pre>

<p>usecase2.h</p>

<pre><code>#ifndef __USECASE2_H__
#define __USECASE2_H__

extern double usecase2_v1;

int usecase2_f1(int n);
char *usecase2_f2();

#endif
</code></pre>

<p>usecase2.cpp</p>

<pre><code>#include &lt;time.h&gt;

double usecase2_v1 = 3.0;

int usecase2_f1(int n) {
    if (n &lt;= 1) return 1;
    else return n * usecase2_f1(n - 1);
}

char *usecase2_f2()
{
    time_t ltime;
    time(&amp;ltime);
    return ctime(&amp;ltime);
}
</code></pre>

<p>usecase3.h</p>

<pre><code>#ifndef __USECASE3_h__
#define __USECASE3_h__

#include &lt;math.h&gt;

namespace foo_namespace {
    static inline float usecase3_f1( float x )
    {
        return 31.0f;
    }
}

#endif
</code></pre>

<p>example1_working.i</p>

<pre><code>%module example

%{
    int usecase1_f1( float b, float c, float *res );
    #include "usecase2.h"
%}

int usecase1_f1( float b, float c, float *res );

%include "usecase2.h"
</code></pre>

<p>example2_not_working.i</p>

<pre><code>%module example

%{
    #include "usecase1.h"
    #include "usecase2.h"
%}

%include "usecase1.h"
%include "usecase2.h"
</code></pre>

<p>QUESTIONS</p>

<ul>
<li>Declaring explicitely namespaced functions like in <code>example1_working.i</code> will work but I'd like to use the headers instead, it seems swig messes up with namespaces, is there any workaround?</li>
<li>How can i wrap namespaced functions declared as static inline in the swig file (usecase3.h)?</li>
</ul>

<p>Make sure you're passing -c++ to swig when you run it, C++ support isn't enabled by default.
See here for more details on wrapping C++ - <a href="http://www.swig.org/Doc1.3/SWIGPlus.html" rel="nofollow">http://www.swig.org/Doc1.3/SWIGPlus.html</a></p>

python c++ namespaces inline swig