A function you must write to initialize resources shared between plugins in a DLL
typedef int ResPluginLoadingF_t ( const char *path )
This function is exported in the ResPlugin_t structure
This function is called right after the DLL is loaded into PhAB's address space, and should set up any resources that are common to the plugins found in the DLL. In particular, if you use PhAB to build a database of widgets that are going to be used to create instances of various plugins, you should initialize its AbContext structure by calling ApAddContext( &AbContext, path)
Since it is possible to have different pathnames that point to the same file, this function may be called more than once, but it's guaranteed that the corresponding ResPluginUnloadingF_t unloading function will be called the same number of times.
This function should return a non-zero value to indicate a serious failure. This will prevent PhAB from attempting to use the resource editors in the DLL.
This example loading function is from the complete plugin example at the end of this chapter.
static int loaded_count = 0; static ApDBase_t *db = NULL; static int plugin_loading( const char *path ) { if( loaded_count == 0 && ApAddContext( &AbContext, path ) ) return -1; db = ApOpenDBase( ABM_string_db ); ++loaded_count; return 0; }
QNX Neutrino
ApAddContext(), ResPlugin_t, ResPluginUnloadingF_t.