: I'm wondering if there are any tools to compile a function during
: runtime. Basically, my situation is this:
:
: I have a function on a data path, where throughput is extremely
: important. There are a dozen variables (mostly bools, but a couple
: of ints) and one data type, which will rarely change (maybe every
: billion or so itterations). What I'd like to do is to compile the
: function in run time, treating the variables as constants, and get a
: pointer to an optimized function. I then use that pointer to run
: the booleans. The function itself does not access hardware, or have
: any external dependencies, so it would not have to be linked into
: anything.
:
: I'm working on a Linux system, but I would be curious to know if
: this is possible on a Windows platform as well.
:
: John
:
It isn't possible, or at least it is too complicated to bother with. There is however no reason at all to compile C/C++ code in runtime, no matter the platform.
void func(void* generic_pointer, int behavior)
{
switch(behavior)
{
case SOMETHING:
/* Assume that generic_pointer points at a certain struct of variables. */
break;
}
}