I'm tying to disable checked iterators in release builds defining _SECURE_SCL=0.

On the other hand I'm using the multithreaded DLL runtime. This seems to have
been built with _SECURE_SCL=1 defined. It also seems that it contains an
instantiation of std::string.

The net result is that the following code uses checked iterator which I would
like to avoid in release builds.

bool foo( const std::string& sstr )
{
for ( std::string::const_iterator n = sstr.begin() ; n != sstr.end() ; ++n )
if ( ! isdigit( *n ) )
return false;
return true;
}

Is there a workaround for this? Can I define something to force the compiler to
use the STL headers instead of the code in the DLL runtime for std::string?

Thanks in advance.


--
Please remove "sam_" from email address.

Re: checked iterators and /MD by Alex

Alex
Sun Oct 22 07:52:17 CDT 2006

Sam wrote:
> I'm tying to disable checked iterators in release builds defining _SECURE_SCL=0.
>
> On the other hand I'm using the multithreaded DLL runtime. This seems to have
> been built with _SECURE_SCL=1 defined. It also seems that it contains an
> instantiation of std::string.
>
> The net result is that the following code uses checked iterator which I would
> like to avoid in release builds.
>
> bool foo( const std::string& sstr )
> {
> for ( std::string::const_iterator n = sstr.begin() ; n != sstr.end() ; ++n )
> if ( ! isdigit( *n ) )
> return false;
> return true;
> }
>
> Is there a workaround for this? Can I define something to force the compiler to
> use the STL headers instead of the code in the DLL runtime for std::string?

Define _STATIC_CPPLIB in your project. Then `std::string'
will be instantiated within your code instead of
MSVCPxx.dll. However, it will influence other Standard
containers and streams as well, not only `std::string'.


HTH
Alex

Re: checked iterators and /MD by Sam

Sam
Tue Oct 24 18:17:55 CDT 2006

Alex Blekhman wrote:
> Sam wrote:
>> Is there a workaround for this? Can I define something to force the
>> compiler to use the STL headers instead of the code in the DLL runtime
>> for std::string?
>
> Define _STATIC_CPPLIB in your project. Then `std::string' will be
> instantiated within your code instead of MSVCPxx.dll. However, it will
> influence other Standard containers and streams as well, not only
> `std::string'.
>
>
> HTH
> Alex

Tried it but the linker gives me

"fatal error LNK1169: one or more multiply defined symbols found"

after listing a bunch of mangled method names.

--
Please remove "sam_" from email address.

Re: checked iterators and /MD by Alex

Alex
Wed Oct 25 04:04:47 CDT 2006

Sam wrote:
>>> Is there a workaround for this? Can I define something to force the
>>> compiler to use the STL headers instead of the code in the DLL runtime
>>> for std::string?
>> Define _STATIC_CPPLIB in your project. Then `std::string' will be
>> instantiated within your code instead of MSVCPxx.dll. However, it will
>> influence other Standard containers and streams as well, not only
>> `std::string'.
>
> Tried it but the linker gives me
>
> "fatal error LNK1169: one or more multiply defined symbols found"
>
> after listing a bunch of mangled method names.

You should do full rebuild of the project.