This tip only applies if you're:
On Windows
Writing a COM (Component Object Model) wrapper for pyCUDA
Using pywin32 for COM

My goal is to write a COM wrapper for my physics CUDA code (written in
pyCUDA using a SourceModule) so I can talk to it from MSVC and Excel.
The problem this tip solves is that by default a pywin32 COM module
runs both InProc (In Process) and as a LocalServer (as an exe out of
the calling process).

For whatever reason the InProc execution policy causes an '80004005'
error when you try to call a pyCUDA module over COM. The lack of a
hint has cost me a day to solve this problem so, if you're doing this,
add the following line to your COM specification so your module runs
purely as a LocalServer and the error won't occur:
_reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER
(and "import pythoncom" somewhere above)

If the above doesn't make sense then see:
http://oreilly.com/catalog/pythonwin32/chapter/ch12.html#51294
for a guide to a simple COM wrapper, just add the _reg_clsctx_ line
after _reg_clsid_ from the example.

Ian.

-- 
Ian Ozsvald (A.I. researcher, screencaster)
i...@ianozsvald.com

http://IanOzsvald.com
http://MorConsulting.com/
http://blog.AICookbook.com/
http://TheScreencastingHandbook.com
http://FivePoundApp.com/
http://twitter.com/IanOzsvald

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to