I am 99% certain this will require code compiling at runtime, but it is necessary.
I am thinking of making a very simple app that allows advanced users to write in a script-like language in order to customize certain things (basically a build-your-own-app app). This includes OpenGL shaders, custom launch animations, and so on. The thing is that I am purposefully making the language very robust, and, while it is working perfectly, it is very slow. I was thinking about simply translating the script into C code (prototype is already working smoothly) and turning that C code into a code block that can be saved and loaded whenever I need it.
I can do this with the Cocoa/Cocoa-Touch 'NSDictionary' but the overhead in Objective-C really bothers me. I am afraid that the complex code created with Objective-C will be too costly to run like a norma app. You may say this is not going to cause problems, but the constant re-interpreting and numerous function calls that I am already doing will force me to save every byte I have at my disposal. That left me with one option, as far as I can see. I need to compile the code and integrate it into the executable. My question is this: can I compile code stored in a char array and store that in a code block immediately without a relaunch? If so, how?
Note: This app is being made to run on Mac OS 10.6 and higher. It is currently compatible with all versions of Linux and Windows 7 as well, and I would like to keep it that way for as long as possible so it can be released on those operating systems. I do not want to force potential users to get a different operating system if they want to use this app. I can and will sort out all of the other complications, but this issue is confusing me too much.