[C++-sig] class data members

Sam Bloomquist sam at gabrielinteractive.com
Mon Aug 18 21:14:12 CEST 2003


I have an update to the question I posted earlier, shown below.  It turns
out that my crash only happens when the string I am trying to set is longer
than 15 characters.  Anyone have any guesses where the 15 character limit
came from?

I am currently working on moving an application from visual studio 6.0 to
visual studio .net 2003 and boost 1.29.0 to boost 1.30.0 and am having a few
problems with class data members.  My c++ struct and python wrapper are as
follows:

struct JunkObject
{
	bool operator == (JunkObject& jo);
	std::string m_sName;
	int m_iID;
};

class_<JunkObject>("JunkObject")
	.def_readwrite("name", &JunkObject::m_sName)
	.def_readwrite("id", &JunkObject::m_iID);

# Then in python when I do this...

obj = plus.JunkObject()
obj.id = 5

# where "plus" is my boost python module, everthing is fine.  But if I do...

obj.name = "Bob went for a walk in the park."

# my program crashes.  Does anyone see something I'm missing?  This worked
fine in msvs 6.0 and boost 1.29.

-Sam Bloomquist
Gabriel Interactive, Inc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2056 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030818/a63bbfca/attachment.bin>


More information about the Cplusplus-sig mailing list