@CHIP-RTOS C Library - Helper Functions
helper_load_library
Load and link a dynamic link library (DLL). int helper_load_library( const char far * libName,
void far * pFpl,
int * pFplSize,
int maxFplSize); Parameters
libName
- File name of the DLL (with extension!)
pFpl
- Output Parameter: Pointer to the
vector list where on success
the addresses of the DLL's exported functions
will be written.
pFplSize
- Output Parameter: The number of bytes
written to the vector table at pFpl
will
be reported here. This will be at most
maxFplSize
bytes.
maxFplSize
- Maximal size of vector table
at pFpl
, in bytes.
Return Value
- error code
CHIPDLL_ERR_OK: Success, DLL was loaded and functions were exported
CHIPDLL_ERR_COULDNTLD: DLL could not be loaded
CHIPDLL_ERR_NOTFOUND: The dll was not found
DLL specifix error code, defined by the DLL developer.
Comments
- If the DLL is not yet loaded, this function loads and starts the DLL.
The order of the exported functions in the function pointer list
is equal to the order in the DLL,s project export function declaration.
Example:
| |
struct MYDLL
{
int (*myFirstDllFunction)(int k);
long (*mySecondDllFunction)(char *s);
};
int result;
int fplSize;
struct MYDLL myDll;
// Sign in to the DLL. When the DLL is not loaded yet it will be loaded automatically.
result = helper_load_library( "myLibrary.dll", &myDll, &fplSize, sizeof(myDll) );
if (result != CHIPDLL_ERR_OK)
{
// Error while load DLL!
return -1;
}
if ( fplSize < sizeof(myDll) )
{
// Not all functions linked! Maybe it is an older
// version of the DLL ?
helper_unload_library( "myLibrary.dll" );
return -2;
}
// Now the DLL's function can be called
myDll.myFirstDllFunction(5);
myDll.mySecondDllFunction("hello");
// When the DLL is no longer required, the application should sign off.
// When no more applications are signed in, the DLL will be removed from memory.
helper_unload_library( "myLibrary.dll" );
|
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| V1.20 | V1.20 | V1.20 | V1.10 | V1.00 |
Supported by @CHIP-RTOS C Library since version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|