Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Multiple Instance Support

The ctNOGLOBALS define, default in c-tree, places all c-tree global variables in an allocated c-tree global control structure, ctWNGV. This is handled invisibly in most c-tree models and should not interfere with the normal operation of your application.

If your application uses multiple instances or threads, a more detailed understanding of the global structures is required. See Multiple Instance Support and Multi-threaded API for more information.

Basics

FairCom DB ctNOGLOBAL support, defined by default, places all FairCom DB global variables in an allocated structure, the FairCom DB global control structure, ctWNGV. This logic was originally developed for two primary purposes:

  1. To provide a multi-user FairCom DB DLL. By moving the global variables to an allocated structure, it was possible to allocate FairCom DB structures for each application which shares the same FairCom DB DLL. This is useful in environments where FairCom DB is built as a DLL, such as Windows and NT.
  2. To reduce DGROUP requirements. Large d-tree applications such as the d-tree catalog (DTCATLOG) could exceed the 64K DGROUP space limitation with some 16-bit compilers. NO GLOBAL support resolves this problem because variables are placed in allocated structures rather than absorbing DGROUP space (data memory).

When a FairCom DB initialization call is made, FairCom DB checks to see if the structure has been allocated by the application. If the structure has not been allocated, FairCom DB allocates the structure automatically. If additional instances are necessary, use the instance functions listed below. If a pointer is needed to the global structure, declare ctWNGV in your application and set it to the current instance with:

ctWNGV = (cCTGVAR) GetCtreePointer((pTEXT) WhichCtree());

RegisterCtree()

Register an instance to FairCom DB.

UnRegisterCtree()

Unregister an instance from FairCom DB.

SwitchCtree()

Make the supplied registration ID active.

NextCtree()

Change to the next registered instance.

WhichCtree()

What is the current FairCom DB instanceID.

These functions are described in the function reference section. For examples of this feature, see the Windows samples wtixmg and wtlxmg.

Multiple Instance support is replaced by the thread management API when using the multi-threaded FPUTFGET and client libraries.

TOCIndex