CXX Doc Sample FAILS on VC6!!! (was)Re: simple CXX Q's: pls help

S. Hoon cpu at bigfoot.com
Sun May 30 17:20:34 EDT 1999


Hi again,

After looking at docs carefully, I got it my earlier Q about (sequences)
working (yes!). I have a new and evil Q. I was trying to find out how to
raise pythonexceptions.

**** The sample code from CXX docs fails. I am pretty sure I got all the
lib's and inc in there, but I get error msgs! *****

static PyObject*
my_module_seqlen (PyObject *self, PyObject* args) {
    try {
        Tuple t(args); // set up a Tuple pointing to the arguments.
        if(t.length() != 1) throw PyException("Incorrect number of arguments
to seqlen.");
        Sequence s = t[0]; // get argument and be sure it is a sequence
        return new_reference_to(Int(s.length()));
    }
    catch(const PyException&) {
        return Py_Null;
    }
}

elease--------------------
Compiling...
example.cxx
D:\Projects\Cxx\Demo\example.cxx(22) : error C2065: 'PyException' :
undeclared identifier
D:\Projects\Cxx\Demo\example.cxx(26) : error C2143: syntax error : missing
',' before '&'
D:\Projects\Cxx\Demo\example.cxx(26) : error C2059: syntax error : '&'
D:\Projects\Cxx\Demo\example.cxx(27) : error C2065: 'Py_Null' : undeclared
identifier
D:\Projects\Cxx\Demo\example.cxx(37) : error C2059: syntax error : '='
Error executing cl.exe.

example.dll - 5 error(s), 0 warning(s)
***Plus, I still have following Q's pending **********
Does LLNL offer docs on how to use Numpy with CXX as well?
Also would like to send dictionary as well at some point with checks to make
sure the args are List, tuple, or dict and take action accordingly.
If anyone has something already done, please send a e-mail to

mailto:hoon at bigfoot.com
Thanks much in Adv,







More information about the Python-list mailing list