1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 06:40:12 +01:00

ModuleInterface.h needn't distinguish built-in from external usage...

... All is set up so that plug-in providers can be modules that register
their instance-creating function pointers directly with RegisterProvider; no
special symbol name needs to be exported.

That is, they now just need to export ModuleDispatch and GetVersionString, just
like other modules for other purposes.

Duplication of logic from ModuleManager::InitializeBuiltins() is removed.

No examples yet in the previous commits, but it does work in my misc-modules
branch.
This commit is contained in:
Paul Licameli
2020-10-02 15:55:04 -04:00
parent a4c3840861
commit 6242be0a8e
3 changed files with 4 additions and 71 deletions

View File

@@ -135,18 +135,6 @@ public:
virtual void DeleteInstance(ComponentInterface *instance) = 0;
};
// ----------------------------------------------------------------------------
// The default entry point name and the name that will be searched for during
// load if the module has been built as a external library.
// ----------------------------------------------------------------------------
#define MODULE_ENTRY AudacityModule
// ----------------------------------------------------------------------------
// If BUILDING_AUDACITY is defined during the current build, it is assumed
// that the module wishes to be embedded in the Audacity executable.
// ----------------------------------------------------------------------------
#if defined(BUILDING_AUDACITY)
// ----------------------------------------------------------------------------
// Since there may be multiple embedded modules, the module entry function will
// be declared static so as not to interfere with other modules during link.
@@ -184,31 +172,11 @@ static name name ## _instance;
DECLARE_BUILTIN_MODULE_BASE(name) \
void name::Register() \
{ \
RegisterProvider(MODULE_ENTRY); \
RegisterProvider(AudacityModule); \
} \
void name::Unregister() \
{ \
UnregisterProvider(MODULE_ENTRY); \
UnregisterProvider(AudacityModule); \
}
#else
// ----------------------------------------------------------------------------
// When building as an external module, the entry point must be declared with
// "C" linkage and whatever method is used to make the function externally
// visible.
// ----------------------------------------------------------------------------
#define DECLARE_MODULE_ENTRY(name) \
extern "C" __declspec(dllexport) \
ModuleInterface * name(const wxString *path)
// ----------------------------------------------------------------------------
// Define these as empty will effectively remove the embedded registration
// functionality.
// ----------------------------------------------------------------------------
#define DECLARE_BUILTIN_MODULE_BASE(name)
#define DECLARE_BUILTIN_MODULE(name)
#endif
#endif // __AUDACITY_MODULEINTERFACE_H__