Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MSVC: mixing RTTI and non-RTTI code

Posted on 2001-06-05
5
Medium Priority
?
405 Views
Last Modified: 2012-05-04
Hi all,
My question is whether it is safe to mix RTTI-enabled and RTTI-disabled. I am asking, because I guess MSVC adds an
extra pointer to vtable structure, so probably it should not be safe, as compiler will not be able to allocate/deallocate memory properly.

If the answer is "NO", then my other questions is: suppose I have third-party library, how do I tell whether it is RTTI-enabled or not.
Finally, if I have two third-party libraries, one is RTTI-enabled and second RTTI-disabled, how can I make them work together in my program.

Thanks
0
Comment
Question by:proskig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 6155804
>> My question is whether it is safe to mix RTTI-enabled and RTTI-disabled.
probably not, but I don't know for sure.

>> adds an extra pointer to vtable structure,
many compilers use the first entry in vtable to store a pointer to a structure that has the RTTI info.   But VC has to be COM compatible too.  I don't know if COM woudl require the 1st entry to be a working entry.

This will take a little testing....
0
 
LVL 22

Expert Comment

by:nietod
ID: 6155849
VC uses the same vtable for both cases and the first entry is the pointer to the first virtual function.  There will be no incompatibility there.   its possible that it places the RTTI infor before the table.  I'll look into that.   But it seems like it might be safe as long as you don't actually use RTTI.
0
 
LVL 22

Accepted Solution

by:
nietod earned 800 total points
ID: 6155899
VC seems to be storing something before the start of the table.  its not the RTTI info itself and it is not a pointer to it, but it is definitely accessing the doubleword before the start of the table.    This suggests that it is probaly safe to mix RTTI and non-RTTI, if you really have to.
0
 
LVL 5

Author Comment

by:proskig
ID: 6156034
OK, thanks, it looks the same to me
0
 
LVL 22

Expert Comment

by:nietod
ID: 6156087
That was a guess though...
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question