Path: C++ : Eval Function :

C++ Eval Function
C++ Eval Function...


The "eval()" function accepts one string argument.
The string should contain a valid C++ expression.

If their is an error in the expression string an exception is thrown.

The "eval()" function computes a dynamic machine code
function. The function pointer is the return value of the "eval()" function.

The "eval()" function is for i386 hardware architectures only.

This API is available for a fee if you fillout the request form.


Function Declaration

pointer_function_type eval(const char * expr);
var interp(const char * expr);

Example

typedef void * (*pointer_function_type)();
pointer_function_type expr_fun = eval("1 + 1");
void * result = expr_fun();
cout << "result = " << get_int_value(result) << endl;

Example Program

  eval_test.cpp - the eval function test program source code
  auto_eval.h - the eval function test program source code
  eval_test.exe - the eval function test program compiled for win32