Community articleIFSInitialize function
Added by IBM contributorIBM on August 16, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function initializes the API. The parameters specify which version of the API your application should bind with.
You must call this function before calling any of the other functions in the API.


r_error IFSInitialize(
   r_charP progName,
   r_charP progVer,
   r_charP apiVer);


Table 1. initialize parameters
progNamer_charPThe name of the application calling IFSInitialize. This name identifies the application within the .ini file. It also sets the name that is returned by the XFDL applicationName function.
progVerr_charPThe version number of the application calling IFSInitialize. If the .ini file has an entry for this version of the applicaton, the application binds to the version of the API listed in that entry.
apiVerr_charPThe version number of the API that the application should use by default. If the .ini file does not contain an entry for the specific application, the application binds to the API specified by this parameter.


OK on success or an error code on failure.


About Binding Your Applications to the API
When you initialize the API, the IFSInitialize function determines which version of the API to use based on the parameters you pass it. This allows you to exercise a great deal of control over which version of the API is used by your applications, and prevents the problems normally associated with DLL files.
The IFSInitialize function relies on a configuration file to determine which version of the API will bind to any application. This allows multiple versions of the API to co-exist on your computer, and ensures that your applications use the correct version of the API.
The configuration file is called PureEdgeAPI.ini and is installed with the API.
Note: You should redistribute the PureEdgeAPI.ini file with any applications that use the API. See Developing and distributing applications API 4 CCreate New Article.
The configuration file contains a section for each application that calls the API, plus a default [API] section. Each section contains a list of version numbers in the following format:
<version of application> = <path to API>

For example, the configuration file on a Windows® system might look like this:
   7.6.* = C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\76
   7.5.* = C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\75
   1.1.0 = C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\76
   1.0.0 = C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\75

The above example contains the default [API] section and a section for the formSample application. The asterisk acts as a wildcard. In the example, 7.6.* corresponds to 7.6.0, 7.6.1, and so on.
The IFSInitialize function checks the configuration file to see if your application is listed. For example, using the configuration example above, if you make an initialization call as follows:
IFSInitialize("formSample", "1.0.0", "7.6.0")

the application binds to the API in C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\75 because the entry for version 1.0.0 in the formSample section points to C:\Program Files\IBM\Forms Server\4.0\API\redist\msc32\PureEdge\75.
If your application is not listed in the configuration file, the initialization call uses the version of the API in the apiVer parameter. For example, if you make an initialization call as follows:
IFSInitialize("formSample", "2.0.0", "7.6.0")

the application binds to the API in the [API] section that corresponds to 7.6.* because there is no entry for version 2.0.0 in the formSample section.
You can add your own entries to the configuration file before distributing it to your customers, or you can rely on the default API entries.


r_error initialize(void *theInstance)
r_error error;
      error = IFSInitialize("SampleAp", "1.0.0", "5.1.0");
      if (error != OK)
         fprintf(stderr, "IFSInitialize error %hd.\n", error);