evaluating math w/o recompile

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Sep 15 07:31:05 AEST 1989


In article <72603 at yale-celray.yale.UUCP> zador-anthony at CS.YALE.EDU (anthony zador) writes:
>I would like to be able to specify the form of the function f
>at *run time* (no recompiles). That is, i would like 
>to place a line of math
>in some file and have the program read it in and evaluate it.
>I have played around with "hoc", the high order calculator
>described in the Unix Programming Environment by K&P, but that seems
>like overkill for this task. Is there a simpler way?

Because C expressions have to be compiled (in most C environments, anyway),
there's no way to input C language pieces at run time.  You could however
construct a source file, invoke the compiler on it, and execute it to
get the results (into a file or via IPC), assuming a decent operating
system environment.  The portable way to do this is to build a language
translator/interpretor into your application, much along the lines of
the code used in "hoc".



More information about the Comp.lang.c mailing list