These days you should create a .swig or .swigcxx file and use the go
tool. The go tool will run SWIG for you.
> % swig -go example.i
> First thing, right of the bat, what is that .i file and why do I need it?
> From what I have read on the web, it's something generated by visual studio
> to describe the preprocessing that occured before VS compiles your program.
> However, I do not/cannot/wont use Visual Studio, and I can't seem to get a
> good handle on what a .i file even is/does.
No, that is not the .i file. The .i file is the SWIG input file, as
described at
http://swig.org/Doc2.0/SWIG.html#SWIG_nn3 . It's the
same file that the go tool will look for as a .swig or .swigcxx file.
> Ideally I should just be able to run
>
>
> swig -go myFile.h
>
>
> Where myFile includes a bunch of other header and C++ files and swig just
> compiles all of it for me :) obviously, this is ideally, and I am ready to
> have to work harder for this.
That almost works but you generally need more than that, which is what
the .swig file is for.
> If I try to run that command I get from Mac OSX Mountain Lion terminal:
>
>
> SWIG -go: -intgosize option required but not specified
>
>
> Which I imagine is something that would have been defined in the .i file if
> I had one.
No, that does need to be provided on the command line. The go tool
will provide it for you. When running SWIG by hand, it's
-intgosize=64 when building for amd64, -intgosize=32 when building for
386 or arm.
Ian