Fredrik, I now have this. myapp.c -------- #include <string.h> #include <stdlib.h> #include "Python.h"
int doStuff(const char *input, const char *d) { ... } static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // get the arguments from Python int result; char *input = 0; char *d = 0; int ok = PyArg_ParseTuple(args, "ss", &input, &d); if (!ok) return 0; // make the function call result = doStfuff(input, d); // return the result return PyBuildValue("i", result); } static PyMethodDef functions[] = { {"PyDoStuff", wrap_doStuff, METH_VARARGS, "some documentation"}, {NULL, NULL} }; extern PyMODINIT_FUNC initDLLTester(void) { Py_InitModule4( "DLLTester", functions, "my doStfuff function", NULL, PYTHON_API_VERSION ); } ...when I try to compile in Visual C++ 6, I get Linking... Creating library Release/DLLTester.lib and object Release/DLLTester.exp test.obj : error LNK2001: unresolved external symbol _PyBuildValue Release/DLLTester.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Any ideas what's happening here? DLLTester.dll - 2 error(s), 0 warning(s) Fredrik Lundh wrote: > Java and Swing wrote: > > > So is "module.c" a new C file or do I add it to my existing, myapp.c? > > it's a complete module. if you want it to do something other than printing > the arguments, replace the "do stuff" section with your own code. if you > want to call it something else, rename it. if you want to change the API, > change it. it's not that large; you should be able to figure out what it does > and how it does it in no time at all. > > </F> -- http://mail.python.org/mailman/listinfo/python-list