Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
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.




[ Prev ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

PistolSTAR: the de facto standard for Lotus authentication
PistolStar's Password Power integrates with Microsoft Active Directory to enable single sign-on to Lotus applications and automatic recovery of the Notes ID password via self-service reset of the Active Directory password.

  • A single set of credentials to remember - one set of password policies to manage.
  • Cost-effective plug-ins integrate smoothly with your environment.
  • Proven, ground-breaking technology deployed to millions of users.


Learn more.
-- Advertisement --

The Ultimate Notes Domino Training Experience - Amsterdam, 11-13 November
Get in-depth technical training that you can put to use on the job right away at THE VIEW's Admin2008 and Lotus Developer2008 Europe! One registration gets you into your choice of over 70 new and updated expert know-how sessions, one-on-one consultations, hands-on labs, and more.

See complete agendas and register by 10 October to save 495 euros!
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login