Old 10-23-2009, 04:36 AM   #1
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default OutputDebugStr sometimes doesnt work - [SOLVED]

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

Last edited by yhertogh; 10-26-2009 at 01:01 AM.
yhertogh is offline   Reply With Quote
Old 10-23-2009, 05:00 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by yhertogh View Post
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.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 05:10 AM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

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.
schwa is offline   Reply With Quote
Old 10-23-2009, 05:13 AM   #4
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

Quote:
Originally Posted by Xenakios View Post
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
yhertogh is offline   Reply With Quote
Old 10-23-2009, 05:13 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by schwa View Post
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...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 05:28 AM   #6
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

Quote:
Originally Posted by schwa View Post
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.

Quote:
Originally Posted by schwa View Post
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 is offline   Reply With Quote
Old 10-23-2009, 07:07 AM   #7
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

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
yhertogh is offline   Reply With Quote
Old 10-23-2009, 07:09 AM   #8
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by yhertogh View Post
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?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 07:45 AM   #9
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

Quote:
Originally Posted by Xenakios View Post
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
yhertogh is offline   Reply With Quote
Old 10-23-2009, 08:12 AM   #10
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by yhertogh View Post
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.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 08:43 AM   #11
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

Quote:
Originally Posted by Xenakios View Post
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

Last edited by yhertogh; 10-24-2009 at 12:43 AM. Reason: removed source files
yhertogh is offline   Reply With Quote
Old 10-23-2009, 09:10 AM   #12
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

Maybe this is a stupid question, but why not just set breakpoints?
Geoff Waddington is offline   Reply With Quote
Old 10-23-2009, 09:12 AM   #13
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Geoff Waddington View Post
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.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 09:21 AM   #14
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
Default

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.
Geoff Waddington is offline   Reply With Quote
Old 10-23-2009, 09:34 AM   #15
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Geoff Waddington View Post
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...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-23-2009, 12:00 PM   #16
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default

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...
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-23-2009, 12:13 PM   #17
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Fabian View Post
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...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-24-2009, 01:02 AM   #18
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

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.

Quote:
Originally Posted by Xenakios View Post
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.

Quote:
Originally Posted by fabian
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
Attached Files
File Type: txt Copy of csurf_main.txt (11.6 KB, 1660 views)
File Type: txt Copy of csurf_faderport.txt (21.1 KB, 1735 views)
yhertogh is offline   Reply With Quote
Old 10-24-2009, 03:25 AM   #19
Mich
Human being with feelings
 
Join Date: May 2009
Posts: 1,265
Default

Quote:
Originally Posted by Xenakios View Post
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.
Mich is offline   Reply With Quote
Old 10-24-2009, 03:40 AM   #20
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Mich View Post
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...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-25-2009, 08:05 AM   #21
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default

Quote:
Originally Posted by Xenakios View Post
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
yhertogh is offline   Reply With Quote
Old 10-25-2009, 12:04 PM   #22
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default

Quote:
Originally Posted by yhertogh View Post
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
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-26-2009, 01:12 AM   #23
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
Default SOLVED!!!

Quote:
Originally Posted by Fabian View Post
Great minds google alike
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
yhertogh is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.