RE: [C++-sig] RE: ÆC++-sigÅ How to export arrays from C(++) to python using boost

Shukla, Nitin (Export) nitin.shukla at pw.utc.com
Wed Feb 11 14:54:03 CET 2004


I may need bit more clarification I guess. If I am not wrong 
(correct me if I am), your class DLBlob contains an array 
(unsigned char) but I couldn't see this class being exported 
to python module. 

Instead in "BOOST_PYTHON_MODULE" you have exported only 
"PyElement" class which exports the functions "Blob2File" 
and "File2Blob". You have finally made it by writing the 
array into a file and then reading it where it is required. 
This spared you from actually exporting an array to python, 
which is exactly what I want to do. Let me know if that's 
not the correct interpretation of your logic and I have missed 
out something here.

Nitin


> -----Original Message-----
> From: Kirsebom Nikolai [mailto:nikolai.kirsebom at siemens.no]
> Sent: Wednesday, February 11, 2004 6:04 AM
> To: Development of Python/C++ integration
> Subject: RE: [C++-sig] RE: ÆC++-sigÅ How to export arrays 
> from C(++) to
> python using boost
> 
> 
> 
> 
> > -----Original Message-----
> > From: Shukla, Nitin (Export) [mailto:nitin.shukla at pw.utc.com]
> > Sent: 10. februar 2004 18:44
> > To: 'Development of Python/C++ integration'
> > Subject: RE: [C++-sig] RE: ÆC++-sigÅ How to export arrays 
> > from C(++) to
> > python using boost
> > 
> > 
> > Thanks Nikolai. Can you show me the declaration of your class 
> > PyElement.
> > That will give me better understanding of your code and help 
> > me create my 
> > own class.
> > 
> > Nitin
> > 
> > 
> 
> There is really not very much in PyElement:
> 
> PyElement.h:
> #pragma once
> 
> class PyElement : public Element
> {
> public:
> 	int File2Blob(CString fileName);
> 	int Blob2File(CString fileName);
> 	int BlobSize();
> };
> 
> The class Element is a 'big' class - and I cannot share the 
> complete content
> of it.  However, some parts of the class definition is given below.
> 
> class AFX_EXT_CLASS Element : public CObject
> {
> 	...
> 	DLBlob GetBlobValue(){return BlobValue;}
> 	void SetBlobValue(DLBlob BlobValuep)
> 		{if (BlobValue == BlobValuep) return; 
> BlobValue=BlobValuep;
> Modified= TRUE;}
> 	...
> }
> 
> The class DLBlob is in principle a class wrapping an array 
> (unsigned char).
> 
> Hope info is of any use
> Nikolai
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
> 




More information about the Cplusplus-sig mailing list