OONumerics User :

From: Stefan Meinlschmidt (meinlschmidt_at_[hidden])
Date: 2008-01-28 04:26:52


Hi Jason!

> Can anyone tell me if it is possible to send a dynamic string variable to a
> C++ DLL that represents and equation for the DLL to use to calculate values
> in columns of an 2D array that is also passed.

This is a common homework assignment and hobby project:
http://www.google.de/search?q=homework+calculator+parser

I once wrote something similar myself for analyzing data from physics
experiments. You can get the basic idea from the sources:
http://tabcalc.sourceforge.net/

Actually, what you want is basically some (specialized) interpreted
language, so you should have a look at those. Matlab and Octave and
such come to mind, or more general ones like python
(http://docs.python.org/tut/tut.html) (surely someone will step in
here and say "No! Perl is the way to go!", so check that one, too :-)

If you absolutely need the optimized performance of compiled code, you
need to compile your expression, period. I.e. bring the user's input
into a form like:

Column 3[i]=X*(Column1[i]-1)+Y;

Stick it into some C (or whatever) sourcecode frame, put it through
the compiler and run the result. system() will be your friend here.

S.M.