I built a simple class:
class Test
{
public:
Test() {};
virtual ~Test() {};
int Get() { return 4; };
};
and created a binding header file for Swig:
// pair.i - SWIG interface
%module pair
%{
#include "pair.h"
%}
// Parse the original header file
%include "pair.h"
I built the shared library and ran python:
Python 2.2.2 (#2, Feb 5 2003, 10:40:08)
[GCC 3.2.1 (Mandrake Linux 9.1 3.2.1-5mdk)] on linux-i386
Type "help", "copyright", "credits" or "license" for more information.
>>> import pair
>>> f = pair.new_Test()
>>> print pair.Test_Get(f)
4
So this was successful, but the Python script seems incredibly ugly and messy. Is this the cleanest solution for something like this with C++, Swig and Python or is there a better alternative?
Thanks