Adapter registration and the library virtual table

The first step required to develop an adapter is to add the adapter to the adapters.xml registration file.

The following line is an example of how to add an adapter to the adapters.xml file:
<UserAdapter name="File Sample"  alias="SFILE"  id="201"  type="file"  
		library="filesamp" vendor="abc"/>

This contains one key field: the name of the library (library="filesamp"). Note that name must not contain a .DLL, .SO, .SL, or any other library extension.

The adapter must export the library virtual table, which must be given the same name as the library, with _config appended. For example, filesamp_config.

The library virtual table contains a number of pointers to methods and configuration information for the adapter. Its structure is:
struct MPI_LIBRARY_VTABLE

{
size_t nSize;     /* size of this structure */
MPIRC (*pfInitializeLibrary)(void);
MPIRC (*pfDestroyLibrary)(void);
MPIRC (*pfCreateAdapterInstance)(HMPIADAPT *phAdapter, HMPICARD hCard);
MPIRC (*pfDestroyAdapterInstance)(HMPIADAPT hAdapter);
MPIRC (*pfCreateConnectionInstance)(HMPICONNECT *phConnection);
MPIRC (*pfDestroyConnectionInstance)(HMPICONNECT hConnection);
MPIRC (*pfCombinedListen)(HMPIADAPTCOLL hColl,HMPICONNECT hConn);

char lpszCommandMask;     /* Mask of command line arguments defining connection
*/
int nTransMode;     /* single, multiple or non-transactional */
int nBurstType;     /* Unit of work - message or logical */
int bListener;      /* Does the adapter support listener interface */
int bListenerBlocks;     /* Does the listener block */
int bListenerTrans;      /* Is the listener transactional? */
int bRetries;     /* Does the adapter support retries */

/* Source settings */
int bSourceManage;     /* Should RM manage the source? */
int bSourceWarnings;     /* Does the adapter return warnings on sources? */
int nSourceScopes;     /* Which adapter Scope settings are supported for source?
*/
int nSourceOnSuccess;     /* Which OnSuccess settings are supported for source?
*/
int nSourceOnFailure;     /* Which OnFailure settings are supported for source?
*/
int nDefSourceScope;     /* Default Scope setting for source */
int nDefSourceOnSuccess;    /* Default OnSuccess setting for source */
int nDefSourceOnFailure;    /* Default OnFailure setting for source */

/* Target settings */
int bTargetManage;     /* Should RM manage the target? */
int bTargetWarnings;     /* Does the adapter return warnings on targets? */
int nTargetScopes;     /* Which adapter scope settings are supported for target?
*/
int nTargetOnSuccess;     /* Which OnSuccess settings are supported for target?
*/
int nTargetOnFailure;     /* Which OnFailure settings are supported for target?
*/
int nDefTargetScope;     /* Default Scope setting for target */
int nDefTargetOnSuccess;    /* Default OnSuccess setting for target */
int nDefTargetOnFailure;    /* Default OnFailure setting for target */
};
typedef struct MPI_LIBRARY_VTABLE MPI_LIBRARY_VTABLE;