steve3d Posted June 18, 2012 Share Posted June 18, 2012 I don't know if I post this in forum is appropriate, but current C++ Plugin API has one or more limitations that can be easily solved. Current engine only use GetModuleFileName to get application path, but if someone want to use unigine in his own dll and this dll are hosted by another program. like a browser plugin, the GetModuleFileName always returns the full path of firefox.exe or iexplorer.exe, so without the setAppPath function to set application path before engine initialize, the engine will refuse to initialize. related to above, if one plugin are specified within a subfolder of application path, like "plugins/PluginA", then the EnginePlugins.cpp can not load the plugin, because LoadLibrary can not find the dll file to load, because A, there is no search path for that dll plugin, B, LoadLibrary can not use forward slashes So I've made some modifications to source, added a static function of setAppPath to set the applications path, and use SetDllDirectory to add the applications path to dll search path. Don't know many of linux programming, But I'm sure under linux, the problem still exists. Here are patches based on UnigineSDK-source-2012-06-14. apppath.patch.rar Link to comment
steve3d Posted June 25, 2012 Author Share Posted June 25, 2012 updated the plugin loading process, it now can load any relative path plugin. tested on windows, it works fine, but I don't have linux/mac to test, but those part alsoshould work app_path_v2.rar Link to comment
frustum Posted July 8, 2012 Share Posted July 8, 2012 An additional Engine::init() function will be available for engine initialization with arbitrary application path: /** * @brief Initialize a new engine with external graphic application. * @param version Version number (UNIGINE_VERSION). * @param app Pointer to the graphic App class (NULL to ignore). * @param path Application path (NULL to ignore). * @param argc Number of command line arguments. * @param argv Array of command line arguments values. * @param project Project name (NULL to ignore); if set, it forces the engine to store all changing data (log file, cache files, config file) in user profile rather than in a directory with binaries. * @param password Password for the filesystem archives (NULL to ignore). * @return Pointer to the new engine. */ static UNIGINE_API Engine *init(int version,App *app,const char *path,int argc,char **argv,const char *project = 0,const char *password = 0); Link to comment
Recommended Posts