Original Post
Hi, I'm just wondering if anyone can give me advice on using virtual functions, and dynamic_cast with a DLL? Basically, the situation is like this: -A dll contains a class 'Example : public aExample', which is created via a call like so: extern "C" __declspec(dllexport) void *CreateComponent() {return new Example;} -The class contains a virtual function 'Register' -The Register function is called by the main program, after loading the DLL and calling the CreateComponent function. Now the problem is in VC6, this all seems to work, until I try and do: aExample *e=dynamic_cast(the_example_class); and dynamic_cast fails. If I try static_cast it works. I googled, and found that GCC has a bug similar to this, and assumed VC6 also had this bug. When I try and compile with VC7 it will not even call the virtual 'Register' function, and so nothing at all happens. Any possible ideas as to what is going on? Thanks.