# fpInit()

This function initializes an Export session. Its return value, `pContext`, is passed as the first parameter to the File Extraction interface and all other Export functions.

## Syntax

    void* pascal _export fpInit(
        KVMemoryStream    *pMemAllocator,
        char              *pszKeyViewDir,
        char              *pszDataFile,
        KVErrorCode       *pError,
        DWORD              dWord);

## Arguments

`pMemAllocator` | A pointer to a developer-defined memory allocator. If `NULL` is passed, the default C run-time memory allocation is used.
`pszKeyViewDir` | A pointer to the directory where the Export components are located. This is normally the directory `install``\``OS``\bin`, where `install` is the path name of the Export installation directory and `OS` is the name of the operating system.
`pszDataFile` | A pointer to the directory and file name of the Export data file, `formats_e.ini`. This file determines whether a format is supported. If a format does not exist in this file, the conversion fails. The `formats_e.ini` file is normally stored in the directory `install\OS\bin`, where `install` is the path name of the Export installation directory and `OS` is the name of the operating system. See File Format Detection for more information.
`pError` | A pointer to an error code defined in `KVErrorCode` or `KVErrorCodeEx` in `kverrorcodes.h`. See KVErrorCode and KVErrorCodeEx.
`dWord` | Reserved. Must be 0.

## Returns

- If the call is successful, the return value is a pointer passed to all other functions.

- If the call is unsuccessful, the return value is a `NULL` pointer.

## Discussion

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

- If this function returns `NULL`, check `stderr` for the KeyView installation error messages, "`KeyView Export SDK License Key has Expired`" and "`KeyView Export SDK License Key is Invalid"`, and pass them to your application. See the Export SDK Installation Instructions for more information on the KeyView license feature.

- To ensure multithreaded 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, it should be terminated by calling `fpShutdown()`. See fpShutDown().

## Example

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

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

© Copyright 2006-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm