Tuesday, October 24, 2006 3:07:11 AM
1. link problem
To export C++ member funtion to global function, compiler have to deal with
a important step - name mangling.But as different compiler will choose different
name mangling scheme, so client that are cmpiled using a different compiler will not
be able to link successfully with the dll compiled with another compiler.
For name mangling, please reference:
2. binary problem
As for the fundamental weaknesses of c++, lack of standardization at the binary levlel. For
all but the simplest language constructs, compiler vendors often elect to implement language
features in proprietary ways that render objects "untouchable" by code generated by any other
Exception are a classic example of such a language feature. Different compiler implement exception
mechanims in different manner, so one program compiled with Microsoft compiler can not catch the
exception throwed by the Dll compiled by WatCom compiler.
This is because the DWP does not mandate what a language feature must look like at runtime, so it
is perfectly legal for each compiler vendor to implement a language feature in a unique and innovative
reference for the ABI:
3. dll version problem
It's hard to add a vraible member to a class when we want to update our dll. Since after we add a new
variable member, the layout of class member is different, though we can correctly call the member function,
but class_ptr->class_member will work wrongly. Also, the sizeof(class) will be different too, which will cause
a fatal error in running time.
reference for the Essencial COM: