4. Changes in the GCI Interfaces

Previous chapter

Next chapter

4.1  GCI changes

Added GCI methods


A variant of GciClassRemoveAllMethods, which takes a single additional argument, the environmentId in which to remove methods.


This method added to support X509-Secured logins:

(BoolType) GciX509Login(
    GciX509LoginArg *args

A C++ class has been added:


For further details, see GemStone/S 64 Bit X509-Secured GemStone System Administration Guide.

Linker symbols now weak on Linux

Support for GCI application on Ubuntu 18.04 required some changes in the way GemStone shared libraries are built. The shared libraries now contain weak symbols, and the linker flags for linking a GCI application have changed.

Otherwise, this change should have no impact on customer application.

4.2  Foreign Function Interface (FFI) related changes

Pre-parsing of C header files

Previously, the FFI parsing of external C library headers could fail with unexpected token errors, depending on definitions within the header file and its include files. Now, before the FFI performs parsing, the native C preprocessor is automatically run on the header file.

C Preprocessor must be available

On Linux and AIX, cpp must be available, and on Darwin, clang must be available, in order for FFI to parse C header files.

Comment style requirements change

Note that the C preprocessor on AIX only supports ANSI-compliant C; C++ style comments using // are not accepted by the preprocessor.

Comments no longer included in output

A side effect of this change is that comments in the header files are no longer preserved in the output from FFI processing. Inclusion of C comments had been somewhat unreliable since associating the declaration with the comment depended on the convention of the comment preceding the declaration and applying only to a single function, which was not always the case.

GciLibrary instance methods no longer include comments

GciLibrary instance methods are generated using the FFI, and as a result of the preprocessing changes, these methods longer include the comment.

Refer to the GemBuilder for C manual, or the text in $GEMSTONE/include/gci.hf, for function details.

CHeader specification of a library search path

The CHeader class >> path: method previously required a full path to the C header file that you intended to parse. Header files that are included by the specified file are also parsed, and these libraries were found by searching on specific system search path directories.

This did not allow you to use specific versions of include files other than the installed versions. For example, when parsing a header file that includes the OpenSSL headers, parsing would find the installed system versions of OpenSSL, rather than the intended development version.

Now, path specification is more flexible. You may pass only the name of the file to path:, in which case it searches on the system path for both that file and included files.

You can also specify the library search path for a given header file name or path, using the following methods:

CHeader class >> path: filePathString searchPath: searchPathString

CHeader class >> path: filePathString searchPaths: anArrayOfPathStrings

These methods use the specified search path or paths to find the specified file filePathString, and any files referenced by #include directives from that file. If the header files are not found, it will look in the system search paths; the given search paths are searched before the system include directories.

A new method, CPreprocessor >> allSearchPaths, returns the full set of search paths for an instance of CPreprocessor.

Subclassing FFI classes

In earlier versions, FFI methods hard-coded some class names, making subclassing difficult. Species methods have been added to allow subclasses to override behavior. Added methods include:

CPreprocessor >>  cPreprocessorTokenSpecies
CPreprocessor >>  cDeclarationSpecies
CHeader >> cByteArraySpecies
CHeader >> cDeclarationSpecies 
CHeader class >> cPreprocessorSpecies
CDeclaration >> cCalloutSpecies
CDeclaration >> cDeclarationSpecies 
CDeclaration >> cPreprocessorSpecies

Other added and removed methods

The following method have been added by the code changes.

CDeclaration >> byteSizeRounded
CPreprocessor >> insertSearchPath:
CPreprocessor >> searchForInclude:excluding:
CPreprocessorToken >> defineParameters:expansionTokens: 
CPreprocessorToken >> expandArguments: 

The following methods have been removed by code changes:

CPreprocessor >> concatenate:definition:arguments:
CPreprocessor >> createStringLiteralFrom:
CPreprocessor >> createStringLiteralsIn:from:
CPreprocessorToken >> defineParameters
CPreprocessorToken >> defineParameters:string:
CPreprocessorToken >> defineString
CPreprocessorToken >> isVarargsToken
CPreprocessor class >> clearDefaultDefinitions
CPreprocessor class >> defaultDefinitions

4.3  GCI and FFI Bugs Fixed

SIGTERM handler not chained to installed handler in linked GCI

In the libgcilnk library, but not in the libgcirpc library, a SIGTERM handler is not chained to a previously installed handler. (#47862)

Reported bytes sent/received incorrect

Initial value incorrect

When setting up logging using GciDbgEstablishToFile(), the bytes sent and bytes received were not initialized. This results in, for example, GBS call tracing to report a large number of bytes sent and received by the first server call. (#47996)

Printing incorrect on 32-bit Windows

With 32-bit clients on Windows, integer printing may incorrectly print 32-bit values as if they were 64 bit. (#47997)

GciErrSType class >> new incorrect malloc size

The implementation was configured to malloc 2163 bytes, which did not allow for the round-up to 32-bit word boundaries, and should have been 2168. (#47304)

Problems with GciTsFetchUtf8Bytes/GciTsFetchUtf8

The thread-safe GCI call GciTsFetchUtf8Bytes hung in the transport layer, and GciTsFetchUtf8 returned an incorrect size result in *requiredSize. (#47694)

CHeader macros do ## concatenation before argument substitution

When parsing a C header with an expression that performs both ## concatenation and argument substitution, the operations were done in the incorrect order. (#47192)


4.4  Updated Compile and Link Information

Linux Compile and Link Information

Complier version

Red Hat 6.x: gcc/g++ 4.4.7

Red Hat 7.x: gcc/g++ 4.8.5

Ubuntu Linux 16.04: gcc/g++ 5.4.0

Ubuntu Linux 18.04: gcc/g++ 7.3.0

SUSE Linux 12: gcc/g++ 4.8.5

Debugger version

Red Hat 6.x: GNU gdb 7.2-92.el6

Red Hat 7.1: GNU gdb 8.2.1

Ubuntu Linux 16.04: GNU gdb 7.11.1

Ubuntu Linux 18.04: GNU gdb

SUSE Linux 12: GNU gdb 7.9.1

Compiling a user action or GCI application
g++ -fmessage-length=0 -fcheck-new -O3 -ggdb -m64 -pipe 
-D_REENTRANT -D_GNU_SOURCE -pthread -fPIC -fno-strict-aliasing
-fno-exceptions -I$GEMSTONE/include -x c++ -c userCode.c 
-o userCode.o 

The following warn flags are recommended for compilation:

-Wformat -Wtrigraphs -Wcomment -Wtrigraphs 
-Wno-aggregate-return -Wswitch -Wshadow -Wunused-value 
-Wunused-variable -Wunused-label -Wno-unused-function 
-Wchar-subscripts -Wmissing-braces -Wmissing-declarations
-Wmultichar -Wparentheses -Wsign-compare -Wsign-promo 
-Wwrite-strings -Wreturn-type -Wuninitialized
Linking a user action library
g++ -shared -Wl,-Bdynamic,-hlibuserAct.so userCode.o
$GEMSTONE/lib/gciualib.o -o libuserAct.so -m64 
-Wl,--no-as-needed -lpthread -Wl,--as-needed -lcrypt -ldl -lc 
-lm -lrt 
Linking a GCI application
g++ userCode.o $GEMSTONE/lib/gcirtlobj.o -Wl,-traditional 
-Wl,-z,lazy -m64 -Wl,--no-as-needed -lpthread -Wl,--as-needed 
-lcrypt -ldl -lc -lm -lrt -o userAppl

Solaris on x86 Compile and Link Information

Complier version

CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31

Debugger version

Sun DBX Debugger 7.7 SunOS_i386 2009/06/03

Compiling a user action or GCI application
CC -xO4 -m64 -xarch=generic -Kpic -mt -D_REENTRANT 
-features=no%except -c userCode.c -o userCode.o
Linking a user action library
CC -m64 -xarch=generic -G -Bsymbolic -h libuserAct.so -i userCode.o
$GEMSTONE/lib/gciualib.o -o libuserAct.so -Bdynamic -lc 
-lsendfile -lpthread -ldl -lrt -lsocket -lnsl -lm -lpam -lCrun
-z nodefs
Linking a GCI application
CC -xildoff -m64 -xarch=generic -i userCode.o 
$GEMSTONE/lib/gcirtlobj.o -z nodefs -Bdynamic -lc -lpthread 
-lsendfile -ldl -lrt -lsocket -lnsl -lm -lpam -lCrun -o userAppl

AIX Compile and Link Information

Complier version

AIX 6.1 and 7.1 on POWER7: IBM XL C/C++ for AIX, V11.1

AIX 7.1 on POWER8: IBM XL C/C++ for AIX, V13.1.2

Debugger version


Compiling a user action or GCI application
xlC_r -O3 -qstrict -qalias=noansi -q64 -+ -qpic 
-qthreaded -qarch=pwr6 -qtune=balanced -D_LARGEFILE64_SOURCE 
-qminimaltoc -qlist=offset -qmaxmem=-1 -qsuppress=1500-010:1500
-029:1540-1103:1540-2907:1540-0804:1540-1281:1540-1090 -qnoeh 
-I$GEMSTONE/include -c userCode.c -o userCode.o

Depending on your version of AIX, you need to include -DFLG_AIX_VERSION=61, -DFLG_AIX_VERSION=71, or -DFLG_AIX_VERSION=72.

Also note that there is no space in the -qsuppress arguments that are continued on the following line.

Linking a user action library
xlC_r -G -Wl,-bdatapsize:64K -Wl,-btextpsize:64K 
-Wl,-bstackpsize:64K -q64 userCode.o $GEMSTONE/lib/gciualib.o 
-o libuserAct.so -e GciUserActionLibraryMain -L/usr/vacpp/lib 
-lpthreads -lc_r -lC_r -lm -ldl -lbsd -lpam -Wl,-berok
Linking a GCI application
xlC_r -Wl,-bdatapsize:64K -Wl,-btextpsize:64K 
-Wl,-bstackpsize:64K -q64 userCode.o $GEMSTONE/lib/gcirtlobj.o 
-Wl,-berok -L/usr/vacpp/lib -lpthreads -lc_r -lC_r -lm -ldl 
-lbsd -lpam -Wl,-brtllib -o userAppl

DARWIN Compile and Link Information

Complier version

Apple LLVM version 10.0.0 (clang-1000.10.44.4)

Debugger version

lldb-1000.0.38.2, Swift-4.2

Compiling a user action or GCI application
g++ -fmessage-length=0 -O3 -ggdb -m64 -pipe -fPIC 
-fno-strict-aliasing  -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE 
-c userCode.c -o userCode.o 

The following warn flags are recommended for compilation:

-Wno-format -Wtrigraphs -Wcomment -Wsystem-headers -Wtrigraphs
-Wno-aggregate-return -Wswitch -Wshadow -Wunused-value 
-Wunused-variable -Wunused-label -Wno-unused-function 
-Wchar-subscripts -Wno-conversion -Wmissing-braces -Wmultichar
-Wparentheses -Wsign-compare -Wsign-promo -Wwrite-strings 
-Wreturn-type -Wno-nullability-completeness 
Linking a user action library
g++ -dynamiclib userCode.o $GEMSTONE/lib/gciualib.o 
-o libuserAct.dylib -m64 -lpthread -ldl -lc -lm -lpam -undefined
Linking a GCI application
g++ userCode.o $GEMSTONE/lib/gcirtlobj.o -undefined dynamic_lookup 
-m64 -lpthread -ldl -lc -lm -lpam -o userAppl

Windows Compile and Link Information

Complier/Debugger version

Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel

Microsoft Visual C++ 2010 01021-532-2002102-70611

Compiling a GCI application
cl /W3 /Zi /MD /O2 /Oy- -DNDEBUG /TP /nologo /D_LP64 /D_AMD64_
/DNATIVE /I 'VisualStudioInstallPath\atlmfc\include' 
/I 'VisualStudioInstallPath\VC\include' 
/I 'C:\Program Files (x86)\Microsoft
/I '%GEMSTONE%\include' -c userCode.c -FouserCode.obj
Linking a GCI application
link /LIBPATH:"VisualStudioInstallPath\VC\lib\amd64" 
/LIBPATH:"C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A\Lib\x64" -RELEASE
/MANIFESTUAC:"level='asInvoker'" userCode.obj 
%GEMSTONE%\lib\gcirpc.lib ws2_32.lib netapi32.lib advapi32.lib
comdlg32.lib user32.lib gdi32.lib kernel32.lib winspool.lib
Secur32.lib /out:userAppl.exe


Previous chapter

Next chapter