Here is what I want to do:
- Run a program and initialize some data structures.
- Then compile additional code that can access/modify the existing data structures.
- Repeat step 2 as needed.
I want to be able to do this with both
) on Unix-like systems (especially Linux and Mac OS X). The idea is to basically implement a read-eval-print loop for these languages that compiles expressions and statements as they are entered and uses them to modify existing data structures (something that is done all the time in scripting languages). I am writing this tool in
, which generates the
files, but this should not be relevant.
I have explored doing this with shared libraries but learned that modifying shared libraries does not affect programs that are already running. I have also tried using shared memory but could not find a way to load a function onto the heap. I have also considered using assembly code but have not yet attempted to do so.
I would prefer not to use any compilers other than
unless there is absolutely no way to do it in
If anyone has any ideas or knows how to do this, any help will be appreciated.