[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wish I knew before: debugging DLL code; MS VC++/debugger/TS2000i



PureBytes Links

Trading Reference Links

I ran into a humdinger of a bug recently in my DLL code (C++).  This put me 
over the edge and got me digging into trying to get MS VC++'s debugger 
working with TS2000i.  Personally, I've avoided digging too deep into 
MS-specifics, as my programming specialties have focused on unix/C++ and 
Java.  I did bring this up with devsupport@xxxxxxxxxxxxxxxxx way back, but 
the info they provided turned out to be slightly wrong and didn't 
work.  With this bug, I asked them again, but haven't heard back in a week 
(do they not support 2000i anymore?).  Someone else told me it was 
impossible, which gave me enough incentive to figure it out... ;^)

I wish I knew the long ago.  I'm sharing the basics here, so that perhaps 
it will save a few other people boat loads of time and frustration.  If 
anyone has additional insights please feel free to share or correct me.

Basically:
In VC++ 6, under project settings, go to Debug tab.
1) Set "Executable for debug session" to "C:\Program Files\Omega 
Research\Program\ts32.exe" (or wherever you have it)

2) set "Working Directory" to "C:\Program Files\Omega Research\Program\" 
(whereever ts32.exe is)

3) set "Program arguments" to "/embedding"

4) Under "Link" tab, I have "Generate Debug Info" checked.

5) Build project with these settings

6) set break points in code

7) Start debug session ("Build" -> "Start Debugging" -> "Go")

8) Start up TradeStation (has to be AFTER you start debug session)

9) setup workspace and apply analysis techniques that use DLL (and will hit 
breakpoints)

10) Debugger pops to front when breakpoint is hit. Then you can step, look 
at objects, etc. Pretty cool. After all this time, I can finally develop 
without trace statments again! ...well at least depend on them less.

NOTES:

I don't know my way around Microsoft's compiler or specialized libraries 
all that well. Just enough to get along. I stick as close to standard C/C++ 
as possible...whenever given an option, I prefer unix and standards.

I have two configurations setup in my project. One for debug and one for 
release. I don't recall when I set this up or what led me to (it must have 
been a long time ago). This is smart though since the release config will 
be smaller and faster. See "Build" (menu) -> "Configurations..." & "Set 
Active Configuration". ...basically you create another set of project 
settings for each configuration (eg one with debug enabled and one with it 
disabled).