I\'m looking to patch a piece of abandonware with some code.
The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea
I'm not entirely sure what you're trying to accomplish, but the easiest way to do this is probably to inject a thread into the mach task after it starts. A great source of information on doing this (as well as running code to do it) can be found here: http://rentzsch.com/mach_inject/.
Some caveats that you should be aware of:
The easiest solution that doesn't involve patching the binary is to simply use the DYLD_INSERT_LIBRARIES environment variable and then run your application.
set DYLD_INSERT_LIBRARIES to /my/path/libAltInput.dylib
I'm assuming the reason the dynamic linker reported an error is because many fields in the Mach-O file format contain addresses specified as an offset from the beginning of the file so adding another load command would invalidate every address. For example, see the symoff
and stroff
entries in the Mac OS X ABI Mach-O File Format Reference.