gpt4 book ai didi

destructor - 为什么这行代码会出现缓冲区溢出错误?

转载 作者:行者123 更新时间:2023-12-04 21:01:10 26 4
gpt4 key购买 nike

我只有 1 行代码,这是:

pcrecpp::RE re("abc");

在函数内部 OnBnClickedButtonGo() .这个函数在Release模式下会失败,但是在debug模式下可以正常工作。

(我在 Windows XP 上使用 Visual Studio 8。)

错误信息是:
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'.

我怀疑它是它的析构函数,它是不可见的和隐含的......但我真的不知道。

PS:我静态链接到 PCRE lib 7.8 版。
PS2:不是很相关,但可能会帮助一些在链接到 PCRE 库时遇到问题的人(我花了几个小时才整理出来):包括行 #define PCRE_STATIC .

最佳答案

在我的情况下,我有相同的错误消息。在调试中一切正常,但在发布时我收到错误消息。我有一个像 native.dll 这样的原生 C/C++ 库.我创建了一个混合的非托管/托管 C++ 库,它是该库到 .net 的包装器。某处mixed.dll我有一个非托管函数签名声明,例如:

typedef void ( *FunctionOnStartSend)();

为此,我收到了消息,但是如果我在那里添加一个“魔法词”,则没有错误消息:
typedef void (__stdcall *FunctionOnStartSend)(); 

关于destructor - 为什么这行代码会出现缓冲区溢出错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/390389/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com