Function _conRegisterF() Foundation

Registers C-API functions at runtime

Syntax
XPPAPIRET XPPAPIENTRY _conRegisterF(XppRegisterFunction *funcs,
                                    int numOfFuncs,
                                    XppRegisterTable *tbl);
Parameters
XppRegisterFunction *funcs
The table containing symbols and addresses of the functions to be registered.
int numOfFuncs
The number of functions in the table.
XppRegisterTable *tbl
Information required later by the function _conUnregisterF().
Return

The function returns a value > 0 when the registration is successful.

Description

The function _conRegisterF() registers symbolic names of C-API functions at runtime of an Xbase++ application. This is required when C-API functions are linked into a DLL which is loaded dynamically with DllLoad(). In this case, REQUEST declarations cannot be used in the PRG code for declaring symbols for the linker. If REQUEST is used to declare a symbolic name, the DLL must be linked statically.

before a dynamically loaded DLL is released using DllUnload(), all dynamically registered function symbols must be released first with _conUnRegisterF().

Examples
// --------------------------------------------- 
// Xbase++ PRG code for dynamic registration of 
// C-API function symbols 
// 

  #include "DLL.CH" 


  DllLoad( "F2BIN.DLL" ) 
  DllCall( "F2BIN.DLL", DLL_CDECL, "my_register" ) 


// ---------------------------------------------- 
// C-API code for dynamic registration of symbols 
// 

/* 
* Functions declared in static table 
*/ 
XppRegisterFunction MyFuncs = { { "F2BIN", F2BIN } , 
                               { "BIN2F", BIN2F } }; 

/* 
* Static structure to store all information required 
* for later unregistration with _conUnregisterF() 
*/ 
XppRegisterTable MyFuncsInfo; 

/* Function which encapsulates registration. It can be called 
* from the DLL startup routine or via DllCall(). 
*/ 
int my_register() { 
   return _conRegisterF(&MyFuncs, 
                        sizeof(MyFuncs) / sizeof(XppRegisterFunction), 
                        &MyFuncsInfo); 
} 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.