Dynamic Loading

Load Laygo Dll

lgo_LoadLaygoDll()

Load a LayGO API DLL.

Syntax
#include "laygodll.h"

LResult  lgo_LoadLaygoDll
    (
         LaygoDllType  dllType
    );
dllTypelgo_DLL_LOCAL
lgo_DLL_RPC
lgo_DLL_HWI
Description

lgo_LoadLaygoDll() loads either the standard, RPC-enabled or Hardware Interface version of the LayGO API DLL. This function must be called successfully before calling any other LayGO API function. Calling any LayGO API function before a successful call to lgo_LoadLaygoDll() will result in abnormal program termination.

Each successful call to lgo_LoadLaygoDll() must be matched by a call to lgo_UnloadLaygoDll() before lgo_LoadLaygoDll() can be called again. This implies that different versions of the API cannot be loaded at the same time.

As a side-effect, lgo_LoadLaygoDll() sets the value of the global variable lgo_Fn to the address of the function table for the loaded library.

Return Values

If successful, lgo_LoadLaygoDll() returns a non-negative value. Otherwise, it returns a negative value. The return values have no significance other than success and failure.

See Also

lgo_UnloadLaygoDll()

Example
LaygoDllType dllType = lgo_DLL_LOCAL;

if (lgo_LoadLaygoDll(dllType) < 0)
{
    printf("Error: failure loading LayGO DLL.\n");
}
else
{
    /* Process... */

    lgo_UnloadLaygoDll();
}