Vi18nInit


Call the Vi18nInit function to initialize the I18N library.


Syntax

Vi18nError Vi18nInit(void **pContext)

Arguments

 


pContext

void**   A handle to the library’s context.


Returns

This function returns one of the following error codes:

Vi18nSuccess for success

 

Vi18nError_* for an error code identified in Error Codes

 

Vi18nFail for a non-specific error

 


Discussion

You typically call the Vi18nInit function from your gateway driver’s VgwSessionNew callback function.

The Vi18nInit function locates the kvutil dynamic library (kvutil.so on Solaris or kvutil.dll on NT) and other filters using the OS runtime library search path; for example, the LD_LIBRARY_PATH on Solaris. If the Vi18nInit function cannot find the library in the library path, this function will try to find the library in the ../filters directory.

If the Vi18nInit function can locate and load the kvutil library successfully, it returns a handle in the pContext argument, which identifies the library’s context; otherwise, the contents of the pContext argument are undefined.


Example

typedef struct _VgwAppSession {
  VdkStructHeader;            /* Initialize with VdkStructInit */
  VdkCString pszIntCharSet;  /* internal vdk/collection charset */
  VdkCString pszReposCharSet; /* repository charset */
  VdkUint2   nReposCharSet;   /* repository charset enum value */
  VdkUint1   nEndian;         /* repository unicode endian */
  VdkInt4   nRtoIFactor;/* repository to internal charsetfactor */
  VdkVoidp   vi18nContext;    /* vi18n library handle */
} VgwAppSessionRec;

Vi18nError err;
VgwAppSession pVSes = NULL;
...
if( !(pVSes = HeapObject(VgwAppSessionRec)) ){
error = VdkError_OutOfMemory;
goto abort;
}
VdkStructInit(pVSes);
if( (Vi18nSuccess !=
  (err = Vi18nInit((void**)&pVSes->vi18nContext)))
  || !pVSes->vi18nContext ){
  pVSes->vi18nContext = NULL;
      goto abort;
  }