Re: _SECURE_SCL off for DLL and on for static lib
"Martin T." <0xCDCDCDCD@gmx.at> wrote in message
news:g6jps8$7rj$1@registered.motzarella.org
Igor Tandetnik wrote:
Marc Sherman <masherman1970@yahoo.com> wrote:
I'm maintaining a DLL that has _SECURE_SCL = 0 in its project
properties. This DLL links with a static library that has
_SECURE_SCL = 1. Will this cause problems?
Quite likely. Basically, you have code in your program that doesn't
agree on the size or binary layout of certain classes. If objects of
(or pointers or references to) such classes are ever passed between
two disagreeing pieces of code, the program will misbehave (to put it
mildly).
I think I disagree.
Searching C:\<Prg Files>\Microsoft Visual Studio 8\VC\* for
_SECURE_SCL (be sure to include ";*." in the search pattern) I cannot
find any reason to think that size or binary layout of the classes
would be different.
<xutility>, line 426
#if _SECURE_SCL
#define _ITERATOR_BASE _Iterator_base
#else
#define _ITERATOR_BASE _Iterator_base_secure
#endif
struct _ITERATOR_BASE
{ // base of all iterators
typedef _Unchecked_iterator_tag _Checked_iterator_category;
typedef _Unchanged_checked_iterator_base_type_tag
_Checked_iterator_base_type;
typedef _Undefined_inner_type_tag _Inner_type;
// SecureSCL needs the base container
__CLR_OR_THIS_CALL _ITERATOR_BASE()
: _Mycont(0)
{
}
const _Container_base *_Mycont;
};
#if _SECURE_SCL
typedef _Iterator_base _Iterator_base_secure;
#else
struct _Iterator_base
{ // base of all iterators
typedef _Unchecked_iterator_tag _Checked_iterator_category;
typedef _Unchanged_checked_iterator_base_type_tag
_Checked_iterator_base_type;
typedef _Undefined_inner_type_tag _Inner_type;
};
#endif
Note how _Iterator_base has _Mycont member with SECURE_SCL, and doesn't
without. Iterator classes like vector::iterator are ultimately derived
from _Iterator_base.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925