Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

 
alt

Daniel Nashed

 

64bit C-API Toolkit Update and Tips

Daniel Nashed  19 December 2008 14:40:53

I have been looking into the first version of the 64bit C-API toolkit that shipped for D8.0.1 for Win64 and AIX64. The first version was a separate download with a couple of issues.

There is a new combined version of the toolkit available for download on partnerworld where all the issues have been fixed.
In case you have been looking into the first version you should switch to the new version which is called 8.0.1 Interim Fix1

Here is the detailed product code and description of what you should download for Win64.

C1W7BEN - IBM Lotus C API Toolkit for Notes/Domino 8.0.1 Interim Fix1 for Windows 32+64 Bit English / Size 19 MB /  Date posted  26-Nov-2008

In the first version specially the makefiles and examples had issues. The new version now ships a combined version for 32bit and 64bit and has separate makefiles for 32bit and 64bit (e.g. mswin32.mak, mswin64.mak).
Here are the most important points you should check when you start porting your applications


Compiler

First of all you need the Microsoft compiler specified in the user guide to get tools and headers.

Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.41 for AMD64
Copyright (C) Microsoft Corporation.  All rights reserved.
IntelĀ® C++ Compiler for Windows version 9.1

And than you need the Intel Compiler to compile your application.
The current documentation is already quite specific.

IntelĀ® C++ Compiler for Windows version 9.1 is the only supported compiler. It works on top of SDK of Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.41 for AMD64. C API 64bits users need to install Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.41 for AMD64 as well

All the makefiles are using the Intel compiler and IBM is also using the Intel compiler to build Domino 64bit.


Compile Switch Differences

You should take a close look into the makefiles and also the cmp directory which contains the original build flags which are used to build the Domino code.

There are a couple of key differences between 32bit and 64bit compile.

First of all on Windows the 1-byte alignment in 32bit has changed to be a 8/16byte alignment in Win64.
That is the natural alignment on the 64bit platform and also the default alignment for the Intel compiler.
So you have to remove the -Zp compile switch and ensure that your application has no #pragma defines for changing the packing!!!

If you don't take care about the changed alignment your code will crash as soon you use any packed structure -- and Notes uses a lot of those structures...

You should take a close look into the new 64bit defines used in the makefiles. For Win64 you need at least the following (check the example makefiles for details those are just the new 64bit defines)

-DW64 -DND64 -DHANDLE_IS_32BITS -D_AMD64_

Yes, handles are still 32bit! But the windows HANDLE has been changed to 64bit!!
That's why you need to use DHANDLE instead of HANDLE for all Notes handles. This is described in the user guide.

I have changed all my code to use DHANDLE and have defines in my code to add the DHANDLE when compiling 32bit applications.
That helps me to continue to work also with older C-API toolkit versions.


AIX Memory Model Changes

On AIX64 it is very important that the memory model has been changed.
So you have to remove the dataseg and/or the -bD:0x20000000 link flag because the segments are no still 256MB each as a maximum but the server is not limited to 8/9 segments any more.
If you start code that is linked with those flags the server will crash!

For AIX you need at least the following compile switches (just the main differences for 64bit -- you should check the sample makefile for details).

-DHANDLE_IS_32BITS  -DAIX64 -DND64 -D_ALL_SOURCE -DNDUNIX64 -DND64 -DNDUNIX64


Some additional Tips and Infos

You really need to check your makefiles in very detail. And when you start porting specially with the Intel compiler you will notice that you get a lot of warnings.
First of all the Intel compiler is much more strict about conversions. But also inside your application you might run into issues with changed length of variables specified for lib functions outside of Notes.

A simple example are lib functions like strlen which now return more than a WORD which causes a warning.
I have worked around those kind of issues by writing my own strlen wrapper with explicitly type conversion.
IBM does not have this issue in their porting because they have their own internal lib functions for operations like this.

Beside that for my own application the migration worked pretty straight forward because I don't use many external code or 3rd party software.
For example after getting those first issues sorted out (see above) I have ported my SpamGeek extension manager and my NashCom Database Catalog together in less than one day to Win64 and AIX64.
This does only include the changes needed for 64bit, compile and first tests. Not the complete QA.
We have also already ported SecureDomino (from TIMETOACT) to Win64 (still in test but will be released soon).

There are a lot of details to take care about when porting to 64bit but it was a lot easier than I expected.
I am currently working with a couple of ISVs to bring them to speed with their development for Domino 64bit.

There is a lot of confusion about what benefits 64bit brings to Domino with the current 8.0.x and 8.5 release. I think I will blog about this in detail in another post.

This short description was more about the development side. It's not a complete documentation but it can help to save you some time when starting to look into it.


Tip for your Win64 Development Environment

For Win64 you need a separate machine and compile environment. For AIX the machine is 64bit already and the compiler can handle 32bit and 64bit.
There is one additional tip that could save a lot of work.

Even your host operating system is a 32bit Windows (like XP) VMware allows you to install a 64bit Guest OS like Windows 2003 R2 64bit Server if you have a modern 64bit CPU on your machine.
My T61 has an Intel Dual Core which is a 64bit CPU. That allows you to use your normal desktop/notebook for 64bit development :-)
You just need to take care for other vitalization software in 32bit at the same time. For example I had reproducible freeze situations when running an XP in a 32bit Virtual PC at the same time...

I hope you find this short summary useful in case you look into port your own applications.

-- Daniel








Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]