Thanks - my searching eventually yielded this: http://www.boost.org/libs/python/doc/building.html#variants with the appropriate VC6 instructions at the bottom. This took care of it. m.
-----Original Message----- From: Ralf W. Grosse-Kunstleve [mailto:rwgk@yahoo.com] Sent: Friday, June 25, 2004 10:12 AM To: Development of Python/C++ integration Subject: Re: [C++-sig] boost.python crush
Is this under Windows? If yes you have to be very careful how you link. Certain combinations of DLL's lead to obscure failures like yours. There was a thread about this recently; should be in the archieve:
http://mail.python.org/pipermail/c++-sig/
Look for "windows", "dll", "debug". If you are using a different platform post the exact details. Ralf
--- Max Khesin <MKhesin@liquidnet.com> wrote:
I have the following sample class exposed via boost.python:
class String { public: String(const std::string& v):m_val(v){} bool lessThan(const std::string& other) const{return this->m_val<other;} bool greaterThan(const std::string& other) const{return this->m_val>other;} bool equals(const std::string& other) const{return this->m_val==other;} bool regexMatch(const std::string& other) const{return this->m_val==other;} bool withinDistance(const std::string& other, int dist) const{return distance(this->m_val, other)<=dist;} private: std::string m_val; };
BOOST_PYTHON_MODULE(test) { class_<String>("String", init<const std::string&>()) .def("lessThan", &String::lessThan) .def("greaterThan", &String::greaterThan) .def("equals", &String::equals) .def("regexMatch", &String::regexMatch) .def("withinDistance", &String::withinDistance) ; }
I am calling this from python:
import test s = test.String('hallo') s.lessThen('hello') #### <<< CRUSH
the debugger seems to point to an access violation in std::string dtor. I palyed around with making the argument a plain std::string (instead of const std::string&) and const char* - both of those crush, albeit in a different place (also dtors, from the looks of it)
Any idea?
thanks,
max This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
__________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
_______________________________________________ C++-sig mailing list C++-sig@python.org http://mail.python.org/mailman/listinfo/c++-sig
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
participants (1)
-
Max Khesin