开发者

implement bonjour sdk in visual c++ windows forms application

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜