[Pyrex] c++class constructor wrapper error

yang yang kk_q at msn.com
Sat May 5 05:22:08 UTC 2007


pyrex 0.5.1a py2.4.4 freebsd6.2R amd64
I want to wrapper a c++ socket code named "udt" wrote by another 
(udt.sf.net).
I read the docs in the tarall, Michael's Guide to Pyrex, A Quick Guide to 
C++ in Pyrex, and clone the wrapper code like this:

/*file pyudt.pyx*/
.....
10 cdef extern from "core.h":
11	ctypedef struct CUDT:
12		CUDT *CUDT_factory "new CUDT" ()
13		void *delete "delete" (void *o)
.....
26 cdef class PyUDT:
27	cdef CUDT *thisptr
28	def __new__(self):
29		self.thisptr = CUDT_factory()
30	def __dealloc__(self):
31		if self.thisptr:
32			delete(self.thisptr)
33			self.thisptr = NULL

run pyrexc pyudt.pyx, and get this:
pyudt.pyx:29:29: Cannot convert Python object to 'CUDT (*)'
pyudt.pyx:32:14: Cannot convert 'CUDT (*)' to Python object

c++ core.h:
/* UDT_API is a "__declspec(dllexport)" */
class UDT_API CUDT
{
friend struct CUDTSocket;
friend class CUDTUnited;
friend class CCC;
friend class CSndQueue;
friend class CRcvQueue;

private: // constructor and desctructor
   CUDT();
   CUDT(const CUDT& ancestor);
   const CUDT& operator=(const CUDT&) {return *this;}
   ~CUDT();

public: //API
.....

google has no answer to me. I need help

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/




More information about the Pyrex mailing list