I started working on converting my N-Body simulation code over to C/C++ and realized that I had no idea how I’d actually display the results. So… it was time to learn a little about displaying stuff in OS X.
One thing that struck me as ungainly was having to use XCode when really all I wanted to do was get myself a window and draw to it. This lead me to this awesome blog post showing a very minimalist Cocoa app.
With that start, I thought that I’d try to do most of my work in C++ instead of Objective C… so how does one do THAT in OS X?? There seems to be a bunch of literature about how to make C++ calls from Objective C… but not the other way around, which is really what I want to do… I want my C++ code to be the driver of the application and use Objective C to pass events and display results… It was stackoverflow to the rescue with this article: http://stackoverflow.com/questions/1061005/calling-objective-c-method-from-c-method
Essentially, you write yourself a C header with some forward declarations for methods that are later declared in a .mm file. Assuming that you’re coding in C++ instead of C, compile with g++ or you’ll get a lot of strange missing symbols at link-time if you use plain old gcc.
Once I have things going smoothly, I’ll post the skeleton code up on github!