Search DominoPower's 11,429 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Coding Domino server tasks in C (continued)

Debugging a server task
So now that you know how to compile successfully, the job's done, right? Well it is if you never make any mistakes. For the rest of us, debugging a program is pretty much essential. But how do you debug a server task? Since it runs as part of the Domino server and we don't have the Domino server source code, stepping through the Lotus code to our own program isn't possible. The sample programs Lotus provides in the toolkit don't tell you how to do this, just like they don't mention how to compile within the VC++6 IDE. They expect you to use a command line. But with a little bit of smart programming, we can debug within the IDE without the server running at all.

Unfortunately, space doesn't allow me to include all the source code here, so I'll describe what code changes need to be made. You can view the finished source code at your leisure at ftp://ftp.dominopower.com/dominopower/outgoing/issues/dp200012-codingcode.txt. The secret is to turn the server task into a standalone C program when compiling for "Win32 Debug" mode. You do this by using pre-processor instructions and the default variable Microsoft uses to define the debug mode _DEBUG.

#ifdef _DEBUG
//the start of the standalone program goes here
#else
//the start of the server add-in program goes here
#endif

This means the compiler sees a different type of program when using the "Win32 Debug" build from the "Win32 Release" build. You'll see in the source code page for the start of the debug version is:

LAPI_MAIN
{

The start of the addin task is:

STATUS LNPUBLIC AddInMain (HMODULE hModule, int argc, char *argv[])
{

And this is why the Link options for debug mode didn't include the notesai0.obj file. -It's only used for server addins.

If you change the source code for the sample program from the Lotus version to my modified and debuggable version, you should now be able to switch the active configuration to debug, recompile, and then step through the program a line at a time and watch the variables change value.

I hope this has given you a head start on writing your own server tasks using Lotus' C API Toolkit. In my next article, I'll go through the code for a server task that does something useful--the ACLHelp server task. I'll also show you how to cross-compile it to a LINUX platform.

Product availability and resources
For more information on programming in C, visit http://www.palmettohosting.com/~jscottb/.

For a complete dump of the source code for this article, visit ftp://ftp.dominopower.com/dominopower/outgoing/issues/dp200012-codingcode.txt.

Bulk reprints
Bulk reprints of this article (in quantities of 100 or more) are available for a fee from Reprint Services, a ZATZ business partner. Contact them at reprints@zatz.com or by calling 1-800-217-7874.

Ian Cherrill is a Product Manager at 4NF Information Technology Ltd. He can be reached at ian@4nf.co.uk.


« Previous  ·  1  ·  2  ·  3  ·  4
Other articles you might like
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
IBM Lotus to Google Apps Migration Remorse
Webcast Series: Mobile Collaboration with Lotus Software
Domino Login Control for Mobile Apps
Sys Admin Tips March 2010
Quickr place Superusers
Writing Client-Side Javascript for Re-Use
Lotus Notes R8.5.1: Bug in Contacts "Print Selected View"
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login