$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Anton Gluck (gluc_at_[hidden])
Date: 2000-10-06 08:50:45
Dave,
> > That said, I want to mention that I got these three warnings during
> > compilation:
> >
> > d:\py_cpp\extclass.h(71) : warning C4541: 'dynamic_cast' used on
> > polymorphic type 'class py::InstanceHolderBase' with /GR-; unpredictable
> > behavior may result
> > d:\py_cpp\extclass.h(64) : while compiling class-template member
> > function 'class hello::world *__cdecl
> > py::PyExtensionClassConvertersBase<class hello::world>::from_python(struct
> > _object *,struct py::Type<class hello::world *>)' extclass.cpp
> > d:\py_cpp\extclass.cpp(32) : warning C4541: 'typeid' used on polymorphic
> > type 'class py::InstanceHolderBase' with /GR-; unpredictable behavior may
> > result
> > d:\py_cpp\extclass.cpp(32) : warning C4541: 'typeid' used on polymorphic
> > type 'class py::InstanceHolderBase' with /GR-; unpredictable behavior may
> > result
> >
> > I could then import the resulting library into Python, but didn't get much
> > further. I could do "hi_world = hello.world(3)", but could not call any
> > method of hi_world. This is what happens if I try "hi_world.get()":
> > "Debug Assertion Failed! Program: D:\python\python.exe File: dbgheap.c
> > Line: 1017 Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) bla bla".
> > And then Python gives a "RuntimeError: unidentifiable C++
> > exception". Originally I thought this might be because I used the
> > non-debug source files, but when I rebuilt the example with the .._d files
> > I had the same problem. Any suggestions?
>
> Well, the compiler warnings should tell you something. Either you changed
> the options in the VC6 project I supplied or I somehow stripped a crucial
> file which stores compiler options, because /GR- turns off RTTI and the
> library *definitely* relies on the presence of RTTI! Do you know which files
> store these settings?
All my fault - I had built my own workspace and project to work on your
example, and MSVC has /GR- as default (even though this will not be listed
under the project options; no /GR == /GR-). The way to fix this in case
others fall into the same trap: in MSVC go to Project -> Settings -> C/C++
-> C++ Language and check the "Enable Run-Time Type Information (RTTI)"
box. Once I recompiled, everything worked ok.
Once again, many thanks.
> > Yet another detail: When I quit Python after this, I get this message:
> > Runtime Error!
> > Program: D:\python\python.exe
> > R6025
> > - pure virtual funtion call
>
> Yes, I discovered that the method of statically allocating the
> ExtensionClass<> instance doesn't actually work: Python is reference-count
> based, and it doesn't pay to try to subvert that. I'll release an updated
> example soon, but probably not before I release the overloading code. I
> suggest looking at extclass_demo.h/cpp. It may not be simple but it's fairly
> complete and better tested than the example <blush-of-embarrassment>.
I'll have to mull over this for little longer...
> Questions are good. Fire is bad. Fire bad!
Friend Good!
Thanks for all your help,
Toni