Open DOS window and spew debug messages from DLL

一笑奈何 提交于 2019-12-10 10:48:53

问题


I am currently calling a DLL from labview, but I need to be able to debug it realtime (because of it's accessing time sensitive hardware). I would like to just printf() my error assert messages but I am unsure about how to open a DOS window from within the DLL to dump error information to. Has anyone done this before? I know I could do this with a file, and I may have to. printf is just such a handy quick and dirty way to do this though :) .


回答1:


1) Make a call to the windows api AllocConsole.

2) You will probably need to call GetStdHandle to get stdout/stderr.

3) Printf to your hearts content!




回答2:


Instead of using printf() you can use Windows's OutputDebugString() function, and check the debug output in DebugView.



来源:https://stackoverflow.com/questions/1343304/open-dos-window-and-spew-debug-messages-from-dll

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!