tags:

views:

29

answers:

0

I'm trying to compile Box2D for use in C# with SWIG.

I've created this Box2D.i file,

%module Box2D
%{
#include "Box2D/Box2D.h"
%}
%include "Box2D/Box2D.h" 

Which I placed one level up from the Box2D.h file file, and "compiled" it with,

swig.exe -csharp -c++ -includeall -ignoremissing -outdir SWIG Box2d.i

This gives me all the .cs wrapper classes and Box2D_wrap.cxx. Problem is, I'm not quite sure what to do next.

I've tried adding that cxx file back into the C++ project and recompiling with /cli enabled, but when I try using the library in a C# app I just get errors. I've tried creating a fresh CLI library and adding the cxx file and linking both the unmanaged Box2D.dll and .lib, which I think I got the compile once... but that didn't work either.

  1. What am I doing wrong?
  2. How can I get it to work?

Using CMake, Windows 7, Visual Studio 2010, latest Box2D from SVN.