PTLib 2.18.8 release bundle on Windows 8.1.
In src\ptlib\common\pluginmgr.cxx, P_DEFAULT_PLUGIN_DIR is defined as follows:
#ifndef P_DEFAULT_PLUGIN_DIR
# if defined (_WIN32)
# if _WIN64
# define P_DEFAULT_PLUGIN_DIR ".;C:\\Program Files\\PTLib Plug Ins;C:\\PTLIB_PLUGINS;C:\\PWLIB_PLUGINS"
# else
# define P_DEFAULT_PLUGIN_DIR ".;C:\\Program Files (x86)\\PTLib Plug Ins;C:\\Program Files\\PTLib Plug Ins;C:\\PTLIB_PLUGINS;C:\\PWLIB_PLUGINS"
# endif
...
When a PTLib application started as a Windows service, "." (dot) path expands to "C:\Windows\System32". Since this directory contains a huge amount of subdirectories and files, traversing through all that staff recursively by the plugin loader in PProcess::Startup() takes about 15 seconds at service startup!
Although PTLIBPLUGINDIR environment variable can be set, it might not be convinient in some environments: several PTLib applications can be co-installed on the same machine each loading its own locally installed PTLib.dll, and each dll can be built with different options including plugin default directory.
Moreover, from "configure.exe -h" output, I can see no way to specify a required default plugin directory for P_DEFAULT_PLUGIN_DIR to get written to the header file at PTLib build time.
Suggested solution:
Exclude the first path entry ("dot") from P_DEFAULT_PLUGIN_DIR in pluginmgr.cxx.
Fix configure.exe to accept an option for P_DEFAULT_PLUGIN_DIR to pass to this utility by PTLIB_CONFIGURE_OPTIONS environment variable when buildind PTLib.