The DLL entry point name declares to QMP what type of plug-in is being implemented. All plug-ins must have at least one entry point, but a DLL may contain several entry points to implement multiple plug-ins within (one for each entry point). This is entirely acceptable as long as the plug-in implementations can each be independently initialized and utilized by the player.
Some entry points have a number suffix on the name to allow for multiple of the same type plug-in with the same DLL. Most plug-in types do not have the number suffix, which means for such plug-ins only one can be implemented per DLL.
See each Definitions to find its entry point name.
When the player loads a plug-in for use it first calls the entry point for the plug-in where the plug-in must return a specific initialized data structure that contains the flags and functions to use for the plug-in. The player will use these functions for all subsequent calls to the plug-in. It is not expected for the plug-into make player service calls from the entry point.
See each Definitions to find the data structure that must be populated and returned from the entry point.
In some cases a plug-in will not implement all function calls defined for it. In such cases, when implementing the plug-in you should set the function pointer for such functions to NULL. This lets the player know that the function is non-existent, and perform alternate choices if necessary. This is preferable to creating “stub” functions in the plug-in for functions that you don’t wish to implement, as this may not have the desired effect. Function calls that are required, or that cause operational differences when set to NULL, are explained at each plug-in function definition.
You may alter the values of the function pointers set in the initialization structures after initialization. For example, to implement functionality set by user options, you can toggle the value of a function pointer between NULL and pointing to a valid function.
Immediately after calling the plug-in entry point the player will call the plug-in's Initialize function. This is where the plug-in should perform any initialization. It is safe to make calls to the player service function at this time or afterwards.
On the call the Initialize most plug-ins will be passed a pointer to a QCDModInfo Structure structure. The plug-in must appropriately populate this structure before returning from Initialize.
See the QCDModInfo Structure data type for more information.
When a plug-in shutdown function is called, the plug-in must perform all clean-up necessary to prepare for being unloaded for memory. Shutdown is normally called when the player is closing, but shutdown can be called during normal operation too. In either case perform the same full clean-up steps.
If your DLL implements multiple plug-ins only perform clean-up on the plug-in that shutdown was called for. Shutdown will be called for each plug-in type that was initialized before the DLL is unloaded.
|
Copyright (c) Quinnware 2007. All rights reserved.
|