Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

RTTI in library not in the application

What happen if I have a library compiled and linked with RTTI features enabled and I link that library to an application that doesn't support RTTI?
Will my library that uses RTTI functionnality will still work?
[225 byte] By [XAfterX] at [2007-11-11 10:16:50]
# 1 Re: RTTI in library not in the application
Not sure what you mean by a "library compiled and linked with RTTI" enabled. If it's already linked, is it a DLL or some sort of a shared library?
Anyway, the results of mixing both RTTI enabled and RTTI disabled code are undefined. In some cases, it will pass unnoticed but you can never know what will happen. The main problem is that RTTI changes the binary layout of certain objects in the program (not user-defined objects, but implementation specific objects needed for obtaining runtime information about some objects, including the structure of the vtable, the addresses of some functions etc.). My best advice is of course, don't do that. If you have an option to forgo RTTI completely, recompile the original library without RTTI. Playing with different ABIs (application binary interface, i.e. the binary representation of program entities) is never a good idea, to say the least.
Danny at 2007-11-11 20:59:07 >