views:

532

answers:

3

Well, if someone can help that would be nice...cause I'm almost going nuts ! I only have 1 line of code, and this is :

pcrecpp::RE re("abc");

inside a function OnBnClickedButtonGo(). And this function fails in the Release Mode ..! ..while it works OK in debug mode. (I use VS 8 on WinXP)

The error message is : "A buffer overrun has occurred in testregex.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. For more details please see Help topic 'How to debug Buffer Overrun Issues'."

(BTW there is no such topic -arghhh)

I suspect it is the destructor of it, which is invisible and implied...but dunno really Anybody come across anything like this ?? pls ! help ..

PS : I am statically linking to the PCRE lib version 7.8 PS2 : Not very rrelevant but may help some people who have trouble linking to the PCRE library (it took me hours to sort it out) : include the line "#define PCRE_STATIC"

A: 

If it's happening only in release mode, it's possible that something is getting "optimized" out. Try doing something more than just the one liner, like a Match() and maybe even printing out the matches.

codelogic
A: 

I had the same error message in my case. Here is my case: In debug is everything fine, in release the error message. I have a native C/C++ library like native.dll I have created a mixed unmanaged/managed C++ library, which is a wrapper for that library to .net. In this mixed.dll somewhere I have an unmanaged function signature declaration. Like: typedef void ( *FunctionOnStartSend)(); for this the I get the message, but ifI put there " a magic word" than is no errror message: typedef void (__stdcall *FunctionOnStartSend)();

matheszabi
A: 

Here is my fresh history: About a month ago I've got a strange link failure of the VS2008 and that day I dug that setting _SECURE_SCL=0 may help (see link text). And it helped. That day it helped me and I just propagated this setting to all the libs we build at team -- that's because MS says that two libs built with different _SECURE_SCL are incompartible.

Time passed and three days ago I've got a bug when VS2008 says that error message that we see in the first post. And there are no help from the debugger because it overruns only in Release build. I've spend almost 2 days pump'n'jump'n the code of the libs and the overrun was flawed from line to line. Finally I started checking build settings line by line and figured the diff in this setting!

Why, oh why Microsoft guys can't embed some small check in dynamic loader code to test that the library currently running and the one going to be dynamically loaded are incompartible?! Some pice of code that save people's time. Blah!

Aleksandr Vinokurov