Embedding Python in Borland C++ Application
bigjoe615 at my-deja.com
bigjoe615 at my-deja.com
Tue May 2 16:56:04 EDT 2000
I have been able to compile and link a C++
(Borland C++ Builder 4.0) with Python 1.5.2.
I can use the following code to evaluate simple
arithmetic expressions (like 9*9):
...
PyObject *s;
PyObject *PyGlobal=PyDict_New();
AnsiString exp=mFormulaTextDBMemo->Text;
// struct _node*pn=PyParser_SimpleParseString
(exp.c_str(),Py_single_input) ;
s=PyRun_String(exp.c_str
(),eval_input,PyGlobal,PyGlobal);
total=PyInt_AsLong(s);
ShowMessage("Value of expression:"+FloatToStr
(total));
...
I am trying to understand how to use built in
functions like sqrt, pow, etc. PyRun_String
does not seem to work. How would I do this?
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list