KeyView 24.2

# fpInit()

This function initializes an Export session.

## Syntax

    KVErrorCode pascal _export fpInit(
        const char* pszKeyViewDir,
        const char* pszLicense,
        const char* pszIniFile,
        DWORD dWord,
        void** ppContext
    );

## Arguments

`pszKeyViewDir` | A pointer to a string that contains the path of the KeyView Export directory (where the readers and the `formats_e.ini` file are located). This is normally the `install\PLATFORM\bin` directory.
`pszLicense` | A pointer to a string that contains your license key, as provided by OpenText. Copy the key exactly, with no leading or trailing spaces.
`pszIniFile` | A pointer to a string that contains the full path of the KeyView Export configuration file, `formats_e.ini`. This file is normally stored in the directory `install\PLATFORM\bin`, where `install` is the path of the installation directory and `PLATFORM` is the name of the platform.
`dWord` | Reserved. Must be 0.
`ppContext` | A pointer to a context pointer for the session that you want to initialize. When you call `fpInit()`, the context pointer is set to the address of the new session context.

## Returns

The function returns an error code.

- When initialization is successful, the error code is `KVError_Success` and the session context is stored in `*ppContext`. Use the `*ppContext` context pointer in future calls to KeyView - it must be passed as the first argument to many of the File Extraction API and Export API functions.
- When initialization is unsuccessful, the return value is an error code (see KVErrorCode for more information), and `*ppContext` is set to `NULL`.

## Discussion

- If `pszKeyViewDir` is `NULL`, the required components cannot be found. Ensure that it is valid.

- To ensure multi-threaded conversions are thread-safe, you must create a unique context pointer for every thread by calling `fpInit()`. In addition, threads must not share context pointers, and the same context pointer must be used for all API calls in the same thread. Creating a context pointer for every thread does not affect performance because the context pointer uses minimal resources.

- When the conversion context is no longer required, terminate it by calling fpShutDown().

- On Windows, `pszKeyViewDir` and `pszIniFile` must be in the local Windows code page.

## Example

The following sample code is from the `cnv2xml` sample program:

    error = (*KVXMLInt.fpInit)(".", YOUR_KEYVIEW_LICENSE, NULL, 0, &pKVXML);
    if (error != KVError_Success)
    {
        printf("Error initializing KVXML: %d\n", error);
        mpFreeLibrary(hKVXML);
        return 4;
    }

Copyright 1997-2024 Open Text
Version 24.2 | Last updated March 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL KeyView 24.2

Topic Title: fpInit()