Create a C or C++-callable routine that allows a callback handler to be registered to handle MacOSX open document events.
This should be a small simple project compilable with gcc 4.8. Preferably a pure C or C++ solution, although I suspect some objective C code will be required.