Win32 and the clipboard

Greg Landrum glandrum at my-deja.com
Thu Dec 9 15:38:47 EST 1999


In article
<326536345498D311B3BC00105A39802A074522 at newsintern.dspace.de>,
  Stefan Migowsky <smigowsky at dspace.de> wrote:
>
> Mark must somehow missed that thing. If you are building from the
> sources this module is available. Since I haven't used it I don't
> know if it was left out intentionally or by mistake.
>

Since I needed a debug version, I had to install from source anyway.
Unfortunately in the source version I have (which I think corresponds
to build 127, I'm not sure because winCVS and I don't get along so
well) win32clipboard doesn't actually work: importing it leads
to an immediate seg fault under NT.

The problem is that initwin32clipboard() in win32clipboardmodule.cpp
is missing a call to PyWinGlobals_Ensure().  Once I copied some
initialization in from another module to give:
extern "C" __declspec(dllexport) void
initwin32clipboard(void)
{
  PyObject *dict, *module;
  PyWinGlobals_Ensure();
  module = Py_InitModule("win32clipboard", clipboard_functions);
  dict = PyModule_GetDict(module);
  Py_INCREF(PyWinExc_ApiError);
  PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
}

everything worked fine.
(well, I haven't tested it yet, but I can at least import...
which is a step in the right direction)  :-)

-greg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list