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

64bit C-API Toolkit Update and Tips

Daniel Nashed  19 December 2008 15: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








Comments

1Richard Schwartz  21.12.2008 1:29:11  64bit C-API Toolkit Update and Tips

Extremely useful info, Daniel. Thanks!

2Erik Brooks  21.12.2008 4:45:07  64bit C-API Toolkit Update and Tips

Good info - can't wait to hear more about the benefits of 64-bit Domino.

3Grant Lindsay  21.12.2008 23:39:08  64bit C-API Toolkit Update and Tips

Daniel,

Great summary and tips. Thanks for sharing your discoveries.

-- Grant

4Paul  31.12.2008 12:27:01  64bit C-API Toolkit Update and Tips

Valuable information!

Do you know if any antivirus vendor already supports x64 in Windows 2003?

I don't agree with the fact that IBM forces you to use intel's compiler... they should keep supporting only the MS compiler.

5Daniel Nashed  16.01.2009 7:18:17  64bit C-API Toolkit Update and Tips

@Paul, no idea which anti-virus vendor already has a 64Bit version. For the vendors which own their own anti-virus engine it might be easier to port. all others need to wait for available 64Bit toolkits from the anti-virus vendors first.

I would also like to see the Microsoft compiler to be supported. I am not sure about the status. But at the time Domino 8 was ported to Win64 the Microsoft compiler had issues.

So IBM had to switch to the Intel compiler. Many of us have MSDN subscriptions and can use the Microsoft compilers for free.

Buying and installing both compilers is not nice specially for smaller ISVs like myself.

But on the other hand the Intel compiler is the better compiler.

-- Daniel

6Piyush Grover  18.09.2011 15:16:00  64bit C-API Toolkit Update and Tips

Daniel, thanks for the good blog but I have few doubts specific to our application.

Our domino application is using older notesapis and now I want to port it to AIX64 and I don't want to use new libraries/header files provided by the newer versions of domino. Can I proceed successfully with that. One more thing I would like to know if you could share something more, some doc link related to compiler switches.

Thanks

Piyush

7Piyush Grover  18.09.2011 15:18:03  64bit C-API Toolkit Update and Tips

Sorry, I forgot to add that the application is already supported on win32, win64, solaris and AIX(32-bit)

8Karsten Lehmann  27.06.2016 11:40:18  64bit C-API Toolkit Update and Tips

"-DW64 -DND64 -DHANDLE_IS_32BITS -D_AMD64_

Yes, handles are still 32bit! But the windows HANDLE has been changed to 64bit!!"

Thanks a lot for this info!

I was going crazy here why my BLOCKID structure in the Domino JNA project did not work.

Archives


  • [IBM Lotus Domino]
  • [Domino on Linux]
  • [Nash!Com]
  • [Daniel Nashed]