Re: Dynamically introducing code into the application
On Sep 2, 8:45 am, Bala <R.Balaji.I...@gmail.com> wrote:
On Sep 1, 9:35 pm, Erik Wikstr=F6m <Erik-wikst...@telia.com> wrote:
[...]
I did think about the following approach.
1. If there is no Dynamic linking then i might generate a new source
file, compile it, run and get the results into the parent process
through IPC.
2. If there is Dynamic Linking, then create a new library/dll, load
and execute it and get the results in the parent application.
But the issue to be addressed here are
1. How costly would this be in terms of performance since the
application will be getting such different requests continously.
How much time does it take to compile and link a new dynamic
object? On the systems I use, I'd count on something around a
second or two, but it obviously depends.
2. If 2 different Front Ends send me the same query, then i
should be able to recognize them and use the existing shared
library instead of recompiling it.
For what definition of "same query". If textual identity is
sufficient, then you can maintain a hash table with the compiled
queries.
The other approach i was thinking of is to be able to use a
third party high performance regular expression parser and
evaluater if at all that is available to execute the query.
If all you need to handle is regular expressions, that's
definitely the way to go. More generally, I'd probably prefer
some sort of embedded interpreter: many script languages (perl,
python, etc.) can easily be embedded, for example. About the
only time I'd use the compile/link/dlopen solution is if there
was a strict requirement that the dynamic code support all of
C++.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34