Plugins not working with static build

silversoul

07-03-2011 06:42:25

Hello,

I unpacked MyGUI 3.0.1 source zip, and built new VC2008 solution with 'STATIC' option with CMAKE.
And leaving everything unchanged, just built PluginStrangeButton demo EXE.
Executable doesn't run....

Does STATIC option not support plugins?

Beside, what I want was /MT and /MTd binary of library. But changing project to non-DLL runtime brings more errors....


Thanks.

Altren

08-03-2011 13:15:25

Yeah, we forgot about static mode and plugins. This is fixed now.
What you actually need to do is add plugin directory into include directories, then#ifdef MYGUI_STATIC
#include "Plugin.h"
plugin::Plugin* plugin_item = nullprt; // or declare it somewhere else
#endif
init#ifdef MYGUI_STATIC
plugin_item = new plugin::Plugin();
MyGUI::PluginManager::getInstance().installPlugin(plugin_item);
#else
# ifdef _DEBUG
MyGUI::PluginManager::getInstance().loadPlugin("Plugin_StrangeButton_d.dll");
# else
MyGUI::PluginManager::getInstance().loadPlugin("Plugin_StrangeButton.dll");
# endif
#endif
shutdown#ifdef MYGUI_STATIC
MyGUI::PluginManager::getInstance().uninstallPlugin(plugin_item);
delete plugin_item;
plugin_item = nullprt;
#else
# ifdef _DEBUG
MyGUI::PluginManager::getInstance().unloadPlugin("Plugin_StrangeButton_d.dll");
# else
MyGUI::PluginManager::getInstance().unloadPlugin("Plugin_StrangeButton.dll");
# endif
#endif

silversoul

13-03-2011 00:08:10

Thank you for your reply. I'll try.

And one more question, in fact this was what I really want but seemed more difficult...
Is there any way to compile MyGUI with option(Code Generation->/MT & /MTd)? My personal frameworks are build with non-DLL, so I want to merge with consistency....

Altren

13-03-2011 11:38:35

You can always change build options in visual studio, but if you also want to keep this setting between each CMake generation you should change CMAKE_CXX_FLAGS_* manually. To see those options select "Advanced" check box in CMake gui.