|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
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.
Ian Cherrill is a Product Manager at 4NF Information Technology Ltd. He can be reached at ian@4nf.co.uk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 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! |
|
|
|
|
|
|
|
|
|
|