Community articleIFSInitialize function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

This function initializes the API. The parameters specify which version of the API your application should bind with (see the Notes for more details).

You must call this function before calling any of the other functions in the API.


   Sub IFSInitialize(
      progName As String, 
      progVer As String, 
      apiVer As String)


progNameStringThe name of the application calling IFSInitialize. This name is used to identify the application within the .ini file. It also sets the name that is returned by the XFDL applicationName function.
progVerStringThe version number of the application calling IFSInitialize. If the .ini file has an entry for this version of the application, the application will bind to the version of the API listed in that entry.
apiVerStringThe version number of the API the application should use by default. If the .ini file does not contain an entry for the specific application, the application will bind to the API specified by this parameter.


Nothing if call is successful or throws an exception if an error occurs.


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 common DLL files (often referred to as "DLL hell").
IFSInitialize uses 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.
The configuration file contains a section for each application that might call the API, plus a default "API" section. Each section contains a list of version numbers in the following format:
   <version of application> = <folder containing appropriate version of API>

For example, the configuration file might look like this:
   5.1.0 = 51
   5.0.0 = 50
   1.1.0 = 51
   1.0.0 = 50

In this case, the folder indicated on the right hand side of each statement is part of the relative path to the API, and assumes the API was installed in the default folder. For example, under Windows® "50" would resolve to:

You can also specify an absolute path by placing a drive letter before the path. For example, "c:\50" would resolve to:

When you initialize the API, you include three parameters in the initialization call:
  • The name of your application (as it would appear in the configuration file).
  • The version of your application.
  • The version of the API that your application should bind to by default.
The initialization call will first check the configuration file to see if your application is listed. For example, using the configuration file above, if you make an initialization call for "CustomApplication" version "1.1.0", then the application binds to the API in the "51" folder.
If your application is not listed in the configuration file, the initialization call uses the default version of the API. For example, using the configuration file above, if you declare "5.1.0" as the default API, then your application binds to the API in the "51" folder.
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.
Note: IFSInitialize was introduced for version 4.5.0 of the API. Binding does not work in this manner for earlier versions of the API. Do not include earlier versions of the API in the configuration file.


In the example, IFSInitialize initializes the API for the application called aspApp.
   Function LoadForm(FileName)
      Dim DTK, XFDL, TempForm ' objects
      ' Get a DTK object and initialize the API
      Set DTK = CreateObject("PureEdge.DTK")
      DTK.IFSInitialize "aspApp", "1.0.0", "2.6.0"
      ' Get an XFDL object and read the form from the supplied file
      Set XFDL = CreateObject("PureEdge.xfdl_XFDL")
      Set TempForm = XFDL.ReadForm(FileName, 0)
      ' Return the form
      Set LoadForm = TempForm
   End Function

Related tasks