Technotes & goodies
Ls2Capi on iSeries
Calling of C API from LotusScript on iSeries does not work as smoothly as on the rest of platforms.
There are three major showstoppers:
1. Pointers are 16-bytes long. No LotusScript datatype can be used to receive return value by OSLockObject. A lot of useful functionality can not be used.
2. In order to call C code from LotusScript and pass parameters by value, C code must use _System linking convention. This is not the case with Domino. As a result only functions passing parameters by reference (or ByVal As String that also passes a pointer) work fine.
3. Data alignment in LotusScript is different from alignment on other platforms
In order to solve these issues I have generated wrappers that use correct linking convention (see the bottom of this document for a link to Download and installation instructions). All the functions names in wrappers compared to regular Notes C API function names are prefixed with "w", e.g. wNSFDbOpen. w-functions allow to call Notes API function that need to pass parameters byVal.
The wrappers contain also a second group of functions prefixed with "x" or x-functions allow to workaround the long pointer limitations. They also facilitate passing structures byVal that is fairly kludgy task on other platforms. x-functions when they pass pointers or structures always pass them by reference.
The list of x-functions. First group has been modified exactly as mentioned before they pass pointers and structures only by reference. Mind you corresponding w-functions are also available for the functions in the list. If you know what you do they might sometimes also be useful.
Function xNSFItemInfoNext illustrates another type of modification. It has been modified to enable passing pointer by reference. It has C signature:
NLS_STATUS LNPUBLIC CALLING_MODIFIER xNLS_unload_charset (NLS_PINFO * ppInfo)
For installation instructions see Installation of Ls2capi wrappers for iSeries
This website contains material that complements "LotusScript to Lotus C API Programming Guide". Some parts of it including posting of comments and discussion items are available only to authenticated readers of the book. Enter your username and password to authenticate.
You should have received your username and password by email to the address you provided during the purchase of the book. In case you failed to receive it or you have any problems loging in let me know about it.