|
|
|
10-23-2009, 04:36 AM
|
#1
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
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.
|
|
|
10-23-2009, 05:00 AM
|
#2
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by yhertogh
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.
|
|
|
10-23-2009, 05:10 AM
|
#3
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
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.
|
|
|
10-23-2009, 05:13 AM
|
#4
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
Quote:
Originally Posted by Xenakios
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
|
|
|
10-23-2009, 05:13 AM
|
#5
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by schwa
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.
|
|
|
10-23-2009, 05:28 AM
|
#6
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
Quote:
Originally Posted by schwa
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
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
|
|
|
10-23-2009, 07:07 AM
|
#7
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
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
|
|
|
10-23-2009, 07:09 AM
|
#8
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by yhertogh
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.
|
|
|
10-23-2009, 07:45 AM
|
#9
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
Quote:
Originally Posted by Xenakios
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
|
|
|
10-23-2009, 08:12 AM
|
#10
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by yhertogh
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.
|
|
|
10-23-2009, 08:43 AM
|
#11
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
Quote:
Originally Posted by Xenakios
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
|
|
|
10-23-2009, 09:10 AM
|
#12
|
Human being with feelings
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
|
Maybe this is a stupid question, but why not just set breakpoints?
|
|
|
10-23-2009, 09:12 AM
|
#13
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Geoff Waddington
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.
|
|
|
10-23-2009, 09:21 AM
|
#14
|
Human being with feelings
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,184
|
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.
|
|
|
10-23-2009, 09:34 AM
|
#15
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Geoff Waddington
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.
|
|
|
10-23-2009, 12:00 PM
|
#16
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
|
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...
|
|
|
10-23-2009, 12:13 PM
|
#17
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
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...
|
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.
|
|
|
10-24-2009, 01:02 AM
|
#18
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
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
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
|
|
|
10-24-2009, 03:25 AM
|
#19
|
Human being with feelings
Join Date: May 2009
Posts: 1,265
|
Quote:
Originally Posted by Xenakios
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.
|
|
|
10-24-2009, 03:40 AM
|
#20
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by Mich
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.
|
|
|
10-25-2009, 08:05 AM
|
#21
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
Quote:
Originally Posted by Xenakios
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
|
|
|
10-25-2009, 12:04 PM
|
#22
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
|
Quote:
Originally Posted by yhertogh
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...
|
|
|
10-26-2009, 01:12 AM
|
#23
|
Human being with feelings
Join Date: Nov 2006
Location: Belgium
Posts: 1,462
|
SOLVED!!!
Quote:
Originally Posted by Fabian
|
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
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:29 AM.
|