[C++-sig] printf from an extension (original) (raw)
mike cantor mcantor at stanford.edu
Fri Dec 9 01:41:24 CET 2005
- Previous message: [C++-sig] How to create package structure in single extension module
- Next message: [C++-sig] printf from an extension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I am extending python with C and trying to debug with printf. The code below succssfully returns the string "hello" when compiled and called, but the "can print from in here phrase" does not reach python stdout. Is there something screwy with my environment or is there some trick to this that I don't know. Any help would be greatly appreciated!
-mike
#include <Python.h>
static PyObject* helloworld(PyObject* self) { printf("can print from in here?"); return Py_BuildValue("s", "hello"); }
static char hw_docstr[] = "hello docstr";
static PyMethodDef hw_funcs[] = { {"helloworld", (PyCFunction)helloworld, METH_NOARGS, hw_docstr}, {NULL} };
void inithelloworld(void) { Py_InitModule3("helloworld",hw_funcs, "simple module"); }
- Previous message: [C++-sig] How to create package structure in single extension module
- Next message: [C++-sig] printf from an extension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]