在视觉c中实现bonjour sdk++ Windows 窗体应用程序

发布于 2024-09-25 13:53:45 字数 470 浏览 3 评论 0原文

我已经在 Visual C++ 控制台应用程序中成功实现了 bonjour sdk。但是当我尝试在 Windows 窗体应用程序(Visual C++)中实现相同的代码时,我收到奇怪的错误,可能与 bonjour dll 的某些本地堆问题有关。

文件 dbgheap.c 中的以下断言失败:

/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));

如果有人知道处理此类问题的一些资源,那将非常有帮助。

非常感谢您的帮助

I have succesfully implemented the bonjour sdk in a visual c++ console app. but when I am trying to implement the same code in a windows forms app (visual c++) I am receiving weird errors probably related to some local heap problem with the bonjour dll.

The following assertion in the file dbgheap.c fails:

/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));

It would be really helpful if someone knew some resources dealing with this kind of problem.

Thanks a lot for any help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

路还长,别太狂 2024-10-02 13:53:45

您没有向我们提供太多信息,但可以从以下地方开始查找:

它可能是从另一个堆分配的

您是否正在释放 Bonjour 分配的对象? bonjour.dll 链接到哪个 C 运行时库?您是否在表单应用程序中使用相同的应用程序(DLL 或静态、多线程或非多线程、调试或发布)?您使用的控制台应用程序是否与控制台应用程序中的相同?

一般来说,出于这种原因释放在其他 dll 中分配的内存是一个坏主意。是否没有可以调用的 BonjourFree 函数来释放 Bonjour 中分配的对象?

或者,您可能会超出缓冲区并独立地覆盖 Bonjour 上的调试内存分配边界。尝试查看失败空闲处的内存,看看它是否正确。

You haven't provided us with very much information, but one place to start looking is this bit:

it may have been allocated from another heap

Are you freeing objects allocated by Bonjour? Which C runtime library is bonjour.dll linked against? Are you using the same one (DLL or static, multithreaded or not, debug or release) in your forms app? Are you using the same one as in your console app?

In general it's a bad idea to free memory allocated in other dlls for this sort of reason. Isn't there a BonjourFree function you can call to deallocate objects allocated in Bonjour?

Alternatively you may be overrunning a buffer and overwriting the debug memory allocation boundaries indepdently on Bonjour. Try looking at the memory at the failing free and see if it looks correct.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文