PDA

View Full Version : OutputDebugStr sometimes doesnt work


yhertogh
10-23-2009, 04:36 AM
OK, this doesnt make any sense to me at all.

My first project i actually inherited from Xenakios, and OutputDebugStr() always managed to send stuff to DebugView.

I now created a new project, and weirdly enough the OutputDebugStr() calls in my main.cpp always make it through to DebugView. But calls to OutputDebugStr() in my 'real' .cpp file DONT ...wtf ? I cant figure this out i tell ya.

Any help appreciated.

Yves

Xenakios
10-23-2009, 05:00 AM
OK, this doesnt make any sense to me at all.

My first project i actually inherited from Xenakios, and OutputDebugStr() always managed to send stuff to DebugView.

I know created a new project, and weirdly enough the OutputDebugStr() calls in my main.cpp always make it through to DebugView. But calls to OutputDebugStr() in my 'real' .cpp file DONT ...wtf ? I cant figure this out i tell ya.

Any help appreciated.

Yves

First possibility is that you have something like :

#define OutputDebugStr(a) {}

at the beginning of your .cpp file. If not, not it's a bit more mysterious. No ideas really.

schwa
10-23-2009, 05:10 AM
1. make sure you have only one DebugView window open.

2. if you are running in the MSVC debugger, debug output will show up in MSVC, not in DebugView.

yhertogh
10-23-2009, 05:13 AM
First possibility is that you have something like :

#define OutputDebugStr(a) {}

at the beginning of your .cpp file. If not, not it's a bit more mysterious. No ideas really.

Nope, no such #define's there. THis is really really weird. I would assume OutputDebugStr() bypasses any windows/reaper stuff right ?

Yves

Xenakios
10-23-2009, 05:13 AM
2. if you are running in the MSVC debugger, debug output will show up in MSVC, not in DebugView.

Right, this has caught me a few times... ;)

yhertogh
10-23-2009, 05:28 AM
1. make sure you have only one DebugView window open.

Checked this, but also the problem does not occur for calls in one cpp, but does occur in another cpp of the same project.

2. if you are running in the MSVC debugger, debug output will show up in MSVC, not in DebugView.

I dont think i am running in the msvc debugger, I've built the dll as 'release', that should do it right ? Or is there some other option i need to set ?

Yves

yhertogh
10-23-2009, 07:07 AM
OK, I am severely lost here. Any more ideas are welcome.
Why would OutputDebugStr behave differently in one cpp files versus another cpp file, knowing that they are part of the same PROJECT in MSVC!!

Yves

Xenakios
10-23-2009, 07:09 AM
OK, I am severely lost here. Any more ideas are welcome.
Why would OutputDebugStr behave differently in one cpp files versus another cpp file, knowing that they are part of the same PROJECT in MSVC!!

Yves

Deos your .cpp file include a header file that has #define OutputDebugStr(a) {} or similar?

yhertogh
10-23-2009, 07:45 AM
Deos your .cpp file include a header file that has #define OutputDebugStr(a) {} or similar?

actually both the 'working' and 'not-working' cpp files include the same header files, and none of the header files have this #define defined.

So no...

damn, getting a bit frustrated here.

Yves

Xenakios
10-23-2009, 08:12 AM
actually both the 'working' and 'not-working' cpp files include the same header files, and none of the header files have this #define defined.

So no...

damn, getting a bit frustrated here.

Yves

What are you exactly trying to put to the OutputDebugStr() calls? Debugview.exe can sometimes determine it's output it can't write out.

yhertogh
10-23-2009, 08:43 AM
What are you exactly trying to put to the OutputDebugStr() calls? Debugview.exe can sometimes determine it's output it can't write out.

Just simple quoted stuff like OutputDebugStr("in function blah"). Stuff i have been doing for months now in other projects.



Thanks

Yves

Geoff Waddington
10-23-2009, 09:10 AM
Maybe this is a stupid question, but why not just set breakpoints?

Xenakios
10-23-2009, 09:12 AM
Maybe this is a stupid question, but why not just set breakpoints?

Too inconvenient often, at least in my opinion, for something that does stuff in response to realtime events.

Geoff Waddington
10-23-2009, 09:21 AM
Well, I know this also may sound silly, but since you are grasping at straws.....

Are you sure the FaderPort contsructor -- CSurf_FaderPort(int indev, int outdev, int *errStats) is getting called?

If it isn't no debug output would show up and OnMIDIEvent might not get called either if things didn't get set up correctly so that debug output would also not show up.

Xenakios
10-23-2009, 09:34 AM
Well, I know this also may sound silly, but since you are grasping at straws.....

Are you sure the FaderPort contsructor -- CSurf_FaderPort(int indev, int outdev, int *errStats) is getting called?

If it isn't no debug output would show up and OnMIDIEvent might not get called either if things didn't get set up correctly so that debug output would also not show up.

Yes, indeed, if the constructor fails, nothing else in the code would run anyway, so no wonder if no debug output is outputted...

Fabian
10-23-2009, 12:00 PM
The CSurf_FaderPort constructor calls OutputDebugStrW to tell that it's constructing.
Searching all the files in my SDK download for "OutputDebugStrW" gives nothing.
Google gives only a single hit on "OutputDebugStrW" -- this thread.
Something the matter?

EDIT: Furthermore, searching teh SDK for "OutputDebugStr" I find only "OutputDebugString". Also. MSN/WinAPI uses the same name. "OutputDebugStr" seems non-standard...

Xenakios
10-23-2009, 12:13 PM
The CSurf_FaderPort constructor calls OutputDebugStrW to tell that it's constructing.
Searching all the files in my SDK download for "OutputDebugStrW" gives nothing.
Google gives only a single hit on "OutputDebugStrW" -- this thread.
Something the matter?

EDIT: Furthermore, searching teh SDK for "OutputDebugStr" I find only "OutputDebugString". Also. MSN/WinAPI uses the same name. "OutputDebugStr" seems non-standard...

It seems there's maybe some kind of function name conflict going on. I'd suggest Yves to try to change that one OutputDebugStrW call to OutputDebugStr. If that doesn't help there's some other issue still. It looks like I've been using OutputDebugString() myself...

yhertogh
10-24-2009, 01:02 AM
First off, thanks to all of you for baring with me and trying to help me out. I feel kinda silly for wasting everybodies time for such an issue which has nothing to do with Reaper.

Yes, indeed, if the constructor fails, nothing else in the code would run anyway, so no wonder if no debug output is outputted...

The code actually works. If I send fake midi CC's to reaper, i can see the selected fader move. So I am assuming the constructor is not failing, OnMIDIEvent is getting called allright.

The CSurf_FaderPort constructor calls OutputDebugStrW to tell that it's constructing.
Searching all the files in my SDK download for "OutputDebugStrW" gives nothing.
Google gives only a single hit on "OutputDebugStrW" -- this thread.
Something the matter?

EDIT: Furthermore, searching teh SDK for "OutputDebugStr" I find only "OutputDebugString". Also. MSN/WinAPI uses the same name. "OutputDebugStr" seems non-standard...

Essentially OutputDebugStr and OutputDebugString are the same.. OutputDebugStr actually is defined in MMSystem.h as OutputDebugString, which is again defined in WinBase.h as either OutputDebugStringW or OutputDebugStringA depending on being UNICODE or ASCII. The OutputDebugStrW was a leftover of me trying to change things. It didnt even compile with this.

I've reposted the cpp files, where i changed all calls to OutputDebugStr(). This time it compiles, and the code actually works ok (i see the fader moving in Reaper). DebugView.exe says "success loading FaderPort Plugin" (from csurf_main), but doesnt e.g say. "FaderPort Constructor" (from Csurf_faderport).

Sigh...

Yves






I've re-attached the file again. The OutputDebugStr works in csurf_main , doesnt work in csurf_Faderport

Yves

Mich
10-24-2009, 03:25 AM
Yes, indeed, if the constructor fails, nothing else in the code would run anyway, so no wonder if no debug output is outputted...

That could be easily tested by placing a printf (to stdout) or whatever ones preferred method is right next to the OutputDebugStr and see if you get a response (that is the code is actually executed). However, I assume that was already done.

Xenakios
10-24-2009, 03:40 AM
That could be easily tested by placing a printf (to stdout) or whatever ones preferred method is right next to the OutputDebugStr and see if you get a response (that is the code is actually executed). However, I assume that was already done.

Yes, my mistake, I read Yves' source code wrong. He seems to have the control surface class running, just that there's this peculiar and no doubt frustrating issue with the OutputDebugStr() calls...

yhertogh
10-25-2009, 08:05 AM
Yes, my mistake, I read Yves' source code wrong. He seems to have the control surface class running, just that there's this peculiar and no doubt frustrating issue with the OutputDebugStr() calls...

Yes, the code seems to work, but for some funny reason OutputDebugStr only works in certain cpp files. I just cant get my head around this ?!

Yves

Fabian
10-25-2009, 12:04 PM
Yes, the code seems to work, but for some funny reason OutputDebugStr only works in certain cpp files. I just cant get my head around this ?!


Maybe this... http://unixwiz.net/techtips/outputdebugstring.html

yhertogh
10-26-2009, 01:12 AM
Maybe this... http://unixwiz.net/techtips/outputdebugstring.html

Great minds google alike :D
I already stumbled on this link, but lost intrest after too much programming mumbojumbo. But then you posted it again, and when i read about permissions and understanding what the flow is, and knowing that OutputDebugStr() just quits silently if anything in that flow is broken, the eurocent dropped...

THe thing is that i used the existing control surface SDK code, and removed all but one control surface, but used the same registration as the regular control surface dll would do. Eventhough i selected MY control surface dll in preferences, this seemed to create some debugging (and maybe whatelse) black hole. As soon as i deleted the reaper_csurf.dll my outputDebugStr calls started to work :-)

Learned something new today :)

Thanks everyone for all your help!

Yves