Wrapper function

Java and Swing codecraig at gmail.com
Tue Oct 11 13:38:32 EDT 2005


I am having trouble with a wrapper function...

My C code looks like
-----------------------
#include <stdlib.h>
#include <string.h>
#include "Python.h"

int doStuff(const char *input, const char *d) {...}

PyObject *wrap_doStuff(PyObject *, PyObject *args) {
	int result;
	char *input = 0;
	char *d = 0;
	int ok = PyArg_ParseTuple(args, "ss", &input, &d);
	if (!ok) return 0;

	result = doStuff(input, d);

	return PyBuildValue("i", result);
}

...when I try to compile this I get
"error C2055: expected formal parameter list, not a type list"  and it
points to line 31...which is the line "PyObject *wrap_doStuff(...)".

I am learning based on the following link:
http://wiki.cacr.caltech.edu/danse/index.php/Lots_more_details_on_writing_wrappers

any ideas?  Note, if I remove the wrapper function, it compiles fine
(so its not an issue with Python.h...i don't think), also I am using
Visual C++ 6
on Win xp.

thanks.




More information about the Python-list mailing list