Open DOS window and spew debug messages from DLL

2019-05-27 02:37发布

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 :) .

2条回答
狗以群分
2楼-- · 2019-05-27 03:01

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

查看更多
别忘想泡老子
3楼-- · 2019-05-27 03:08

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!

查看更多
登录 后发表回答