[C++-sig] RuntimeError: unidentifiable C++ exception
Roman Yakovenko
roman.yakovenko at gmail.com
Thu Aug 31 12:26:48 CEST 2006
On 8/31/06, Qun Cao <quncao at gmail.com> wrote:
> Hi Roman,
> Thanks for you suggestions.
> I looked into the custom_string code, it is a nice example but different
> with my problem. I don't want python automatically convert my NiFixedString
> to python string, all I want is a way to use the constructor of
> NiFixedString class to create a python object.
> a = NiFixedString("test")
>
> Theoretically this is no different than wrapping any other class with a
> constructor that takes a string/char const*, and this code should do it,
> right?
Right
> BOOST_PYTHON_MODULE(NiStringTest)
> {
>
> class_<NiFixedString,boost::noncopyable>("pNiFixedString",
> init<char const*>());
> }
>
> Btw, NiFixedString encapsulates a memory efficient implementation of
> reference-counted ASCII strings, here is the header file, is there any thing
> that potentially cause the exception? Also, from my understanding, PY++
> simplifies the process of generating the wrapper code, could adopting PY++
> possibly help with this problem?
No, but it could help you with other problems
> inline NiFixedString::NiFixedString(const char* pcString)
> {
> if (pcString == NULL)
> {
> m_kHandle = NiGlobalStringTable::NULL_STRING;
> }
> else
> {
> m_kHandle =
> NiGlobalStringTable::AddString(pcString);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
My guess here is your problem - NiGlobalStringTable may be have to be
initialized earlier.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list