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

C-API Development for Domino 9 64bit

Daniel Nashed  25 October 2013 09:21:00

The following is a short info for all C-API developers who want to port their applications to native 64bit on Windows.
It took me some time to find the right Microsoft compiler and that's why I want to give you a quick summary.
This can save you some of time and frustation. Once you installed the wrong compiler or did the wrong update you might not be able to re-install the compiler.
I had to switch to a new Windows 2008 R2 VM and re-installed everything from scratch after things went wrong.
The following is the straight way to get your development platform up and running.

-- Daniel


Introduction and History

Since Domino 8.5.x Domino is also available as native 64bit application.
When it shipped the Microsoft 64bit compiler wasn't in a shape that IBM could use it to port Domino to Windows64.
They hat to switch to the Intel compiler in combination with header files from the Microsoft compiler.
The Intel compiler was quite expensive and it wasn't easy to get the right version because it is not the most current Intel compiler.

Notes/Domino 8.5.x

Intel® C++ Compiler for Windows version 9.1

Note: 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.


Starting with Domino 9 the compiler switched back to the Microsoft compiler. Which is really great news!

The compiler used is the Visual Studio 2010 compiler.

Notes/Domino 9.0

You can develop 32-bit programs for all supported Windows 32-bit platforms using Microsoft Visual Studio 2010 SP1 for Windows.
You can develop 64-bit programs for all supported Windows 64-bit platforms using Microsoft Visual Studio 2010 SP1 for Windows.


What you need to install

There are different packages available. What you would normally install is the "Visual Studio Express 2010".
But that does not come with 64bit support for whatever reason. You have to install the Microsoft Windows SDK on top of it and create some batch files that configures your environment if you want to use makefiles.

It tuned out that if you install Visual Studio Express 2010 SP1 on top of this combination the 64bit option does not work any more.
Also the SDK brings it's own installation of Visual Studio 2010 SP1 Standard for x86 and x64.

For the Express version you still have to request a license key. For the SDK no license key is required.

So what you should install is the SDK instead of the compiler and that brings the compiler along.

The next important part is that you should not install the compiler service pack. Instead there is a service pack for the SDK itself, which includes the service pack for the compiler.
That brings you to the right compiler and build level for C-API development with Domino 9 :-)

Here are the two links that you need to install the SDK and SP1.
It's the newer SDK which supports also Windows 7.
But you can bring it into Win2008 "mode".

-- snip --

Microsoft Windows SDK for Windows 7 and .NET Framework 4
http://www.microsoft.com/en-us/download/details.aspx?id=8279

Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
http://www.microsoft.com/en-us/download/details.aspx?id=4422

Install this update to restore the Visual C++ compilers and libraries that may have been removed when Visual Studio 2010 Service Pack 1 (SP1) was installed.
The compilers and libraries are part of the Microsoft Windows Software Development Kit for Windows 7 and the .NET Framework 4 (later referred to as the Windows SDK 7.1).

-- snip --


Configuration of your Environment

Once you have installed the compiler you need to configure the 64bit environment.

By default the x64 does not work because the batch file you need is not installed. The compiler is installed correctly but the cmd file to setup the environment is missing.

The cmd file will report

The specified configuration type is missing. The tools for the configuration might not be installed.

The workaround is to create the file vcvars64.bat which will invoke the setenv.cmd file.

But the best way is to invoke setenv.cmd directly and not use the vcvarsall.bat x64 option.
This also gives you more granular options.

My configuration for 64bit looks like this -- assuming the C-API toolkit is installed in c:\notesapi.

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64 /2008

set lib=c:\notesapi\lib\mswin64;%lib%
set Include=c:\notesapi\include;%include%

Once you have setup your environment you can start compiling the included sample applications.
They will compile and run if you setup the environment correctly.

Afterwards you have a lot of fun looking into the sample makefiles which use the original makefile options with all the fancy switches from building Domino (also shipped with the toolkit in the cmp directory for all platforms).
I went thru all the options and checked them to see what makes sense to change in my makefiles (compared to the makefiles for the older Microsoft compiler and the Intel compiler).
This might take some time but you just might saved at least half a day getting your your compiler up and running ;-)

Also generation of sym files is not supported any more with Domino 9 and 64bit. You have to switch to PDB files.
But that is something where I need to sort our some details and will blog about it once everything is sorted out.
I have it working in my environment but I have to check with IBM for some details.


Comments

1Michael Gollmick  25.10.2013 14:51:58  C-API Development for Domino 9 64bit

Daniel you are the greatest help as always. I had spent hours if not days in an attempt to get all this working for me, but gave up as I was unable to make it run. Now you had your hands on it and we got a clear help on what to do in order dto compile for D9/w64.

Thank you so much!

2Laurent Prat  25.10.2013 18:15:03  C-API Development for Domino 9 64bit

Thx Daniel and Rich who sent me this link

J I was not expected such issues.

I'll watch my steps when upgrading.

many thanks again for sharing this,

regards,

Laurent,

3Daniel Nashed  28.10.2013 15:57:02  C-API Development for Domino 9 64bit

Actually installation is pretty easy once you installed the right product with the right steps and if you know which switches to set.

I am posting for others to avoid spending half a day running into the same issues.

And it is good news that the Windows SDK is free and you can just install it and have the exact right compiler version for C-API development for Notes/Domino 9.

-- Daniel

4Thanks!  27.12.2013 13:17:57  C-API Development for Domino 9 64bit

Daniel,

Thanks a lot for sharing this. I just had to code the first C API for Domino 9 (Win/64) and I spent hours trying to compile and link the sample code until I found this blog entry.

Great information (as always).

Andy

5Peter Rosenberg  06.07.2015 19:08:40  C-API Development for Domino 9 64bit

Thanks for the detailed walkthrough that helped me a good bit on the road.

BUT, my objective is to be able to compile 32bit (client) Notes apps, for the VS 2010 and Win7 (64 bit) targets !

I cannot get around this, that I have googled to be the symptom of 32-bit loading 64-bit DLLs.

I'm on Notes 9.01 FP4 (Win 7, 64 bit OS), and here's the output from Compile/Link:

Microsoft (R) Program Maintenance Utility Version 10.00.40219.01

Copyright (C) Microsoft Corporation. All rights reserved.

cl -nologo -c /MD /Zi /Ot /O2 /Ob2 /Oy- -Gd /Gy /GF /Gs4096 /GS- /favor:INTEL64 /EHsc /Zc:wchar_t- /Zc:forScope- -Zl -W4 -DNT -DW32 -DW -DW64

-DND64 -D_AMD64_ -DDTRACE -D_CRT_SECURE_NO_WARNINGS -DND64SERVER -DPRODUCTION_VERSION -DDUMMY INTROWIN.c

INTROWIN.c

INTROWIN.c(44) : warning C4273: '__argc' : inconsistent dll linkage

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\stdlib.h(283) : see previous definition of '__argc'

INTROWIN.c(45) : warning C4273: '__argv' : inconsistent dll linkage

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\stdlib.h(284) : see previous definition of '__argv'

INTROWIN.c(93) : warning C4100: 'lpCmdLine' : unreferenced formal parameter

INTROWIN.c(166) : warning C4131: 'InitApplication' : uses old-style declarator

INTROWIN.c(176) : warning C4133: '=' : incompatible types - from 'long (__cdecl *)(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'

INTROWIN.c(212) : warning C4131: 'InitInstance' : uses old-style declarator

INTROWIN.c(291) : warning C4133: '=' : incompatible types - from 'BOOL (__cdecl *)(HWND,WORD,WPARAM,LPARAM)' to 'FARPROC'

INTROWIN.c(302) : warning C4244: '=' : conversion from 'INT_PTR' to 'int', possible loss of data

INTROWIN.c(420) : warning C4244: 'return' : conversion from 'LRESULT' to 'long', possible loss of data

INTROWIN.c(447) : warning C4100: 'lParam' : unreferenced formal parameter

e:\notesapi\samples\basic\introwin\introwin.c(384) : warning C4706: assignment within conditional expression

rc -r -fo INTROWIN.res -DWIN32 -D_WIN32 /DNT INTROWIN.rc

Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385

Copyright (C) Microsoft Corporation. All rights reserved.

link /DEBUG /DEBUGTYPE:cv /INCREMENTAL:NO /NOLOGO -subsystem:windows,5.0 INTROWIN.obj INTROWIN.res -nologo -opt:ref -machine:AMD64 -nodefau

ltlib /LARGEADDRESSAWARE -debug -debugtype:cv libcmt.lib kernel32.lib user32.lib gdi32.lib advapi32.lib winspool.lib ws2_32.lib userenv.lib kernel3

2.lib ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib notes.lib -out:INTROWIN.exe

LINK : warning LNK4010: invalid subsystem version number 5.00; default subsystem version assumed

---------------------

And when I run the app, I get

Application unable to start correctly.

RC=0xC000007B

Any clues, or hints for this you might share ?

6Peter Rosenberg  11.09.2015 13:04:06  C-API Development for Domino 9 64bit

Got it working, by digging into the 'setenv.cmd' and your comment on trying to force Command Envrionment into the correct X86 environment.

I have posted the steps I took to get it working on my Blog (sep 11, 2015):

{ Link }

Thanks for pointing me into the right direction.

7Olle  25.11.2015 14:19:18  C-API Development for Domino 9 64bit

I can only second Michael Gollmick. This was really (to say the least) helpful in getting started.

Archives


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