Help - Search - Members - Calendar
Full Version: Make a plugin fail on Init
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
fooxic
Hi All,

I am looking for a way to make a plugin fail (i.e. not loaded as a foobar compnent) if certain (microsoft windows) system component is not available,,,is it safe to modify the core_api? anyways, what would I do to make a component fail safely?
Canar
Just link to it. Your component will fail safely anyhow.
foosion
You have two options. If the system component is a DLL, you can statically link to it like Canar pointed out. If the DLL is not available, your plugin DLL will fail to load and foobar2000 will display an error message.

If you can load the system component dynamically, you can load it in init_quit::on_init() and disable the functionality of your plugin before and unless the system component can be loaded successfully. For example, a menu item could be greyed out or a preferences page could display some diagnostic text in this case. This approach is a lot easier with COM components than it is with DLLs with a lot of functions.
fooxic
The latter option conform to my philosophy of "plugin development(light and weightless)", also the plugin will depend on com components. Off the record; superb SDK. I will go into sales&marketing to convince my clients to buy more RAM wink.gif Thanks for your input all.
foosion
You know, if you are concerned that your users will have a plugin that is useless because of missing dependencies, you could create an installer that checks these dependencies. wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.