In short, you are proposing that instead of linking an executable, it
be made into a bunch of shared libraries. The function calls between
these shared libraries be arbitrated by a "dispatcher" which can
dynamically reroute function calls.
There already exists a technique to do this if you're willing to
restart your app: incremental linking. Many IDEs support something
like this (it's called ZeroLink in Apple's Xcode, for example), and
even GNU ld has the -r option, which makes an object file
relocatable, making it quicker to link.
If you want to be able to do this without restarting, there are some
challenges:
1) Static variables in modules would present problems, as these would
have to somehow be reinitialized to their values in the old module
(for instance, if you have a static pointer to a malloc()ed data
structure).
2) If you plan to interpret code, the C interpreter would have to be
taught to access symbols in other modules if they are undefined in
the module it is interpreting.
3) You would have to figure out how to interpose on functions called
via function pointers.
4) In a multithreaded application, you'd have to make sure that
module replacement is atomic and you handle the case of replacing a
module at a time where a thread is executing a function in it.
Perhaps others on this list can come up with more issues to resolve.
If you can come up with a solid system that addresses the issues with
dynamic replacement of code, you will probably be able to get at
least a conference paper and possibly even a job out of it :)
Sean
On Jan 10, 2006, at 7:32 AM, [EMAIL PROTECTED] wrote:
Dear Sirs.
At the first, let me put a lot of appreciations for what you are
doing.
At the second, respecting your time, I will straight to the matter.
I have some kind of an idea, which I called 'matrix linking'. It
would appear
this is a new kind of linking. Briefly it gives (C/C++) developer the
opportunity to change the business logic of the application at run-
time,
neither recompilation nor restarting required. The point is that
the approach
makes possible to substitute any function of the code, in such wise
some of
them might be merely executed by means of a script machine
(interpreter). The
basic concept and the simple realization of the idea are
represented here:
http://www.georgeshagov.com/matrixlinking/MatrixLinking/
MatrixLinking.pdf. (I
am attaching the article to the message)
I had some ideas how to put the invention in solution (here:
http://docs.georgeshagov.com/twiki/tiki-index.php,
http://docs.georgeshagov.com/twiki/tiki-index.php?page=Matrix
+Linking+-+The+shortest+way+to+go).
What do I want from you is some kind of assistance. Of cause I have
GCC sources
and manuals, theoretically it is enough to make the changes, yet,
if someone
from GCC team had assist me in that the result would be much
better, since you
know the compiler much better than I.
For instance. By now I have these questions:
* I am looking at build_function_call and start_function functions,
these ones
actively use 'tree'. I am not familiar with that. So,:
** Is there any documentation on that?
** Is there any help functions which works with 'tree', like doing
iteration,
dumping and so on.
** What are the external values for cc1? File name for instance,
and so on.
I do understand that these questions seem to be really abstract.
But I think
that to contact GCC team at the very beginning of the investigation
should be a
good idea. For it might be (I believe should be) some architectural
solution,
which might be offered by you will be really useful in the future.
Therefore dear Sirs, if you find the idea interesting and some one
of you will
find a time and a wiliness to cooperate I would be really appreciate.
Sincerely your, George.
<MatrixLinking.pdf>