Added minimal support for LTDL_LIBRARY_PATH with MSVC plugins. Only one path

is supported for now (TODO: add support for a path list similar to ltdl).
Fixed documentation for LTDL_LIBRARY_PATH (Windows path separator).
This commit is contained in:
Volker Ruppert 2013-11-15 19:14:31 +00:00
parent c64dceadb4
commit fc6b64c1b5
2 changed files with 18 additions and 9 deletions

View File

@ -3005,13 +3005,13 @@ machines. See the $(sharedir) variable in the Makefile for the exact
value. $BXSHARE is used in the config files of the Bochs disk images to
locate the directory where the BIOS images and keymaps can be found.
If $BXSHARE is not defined, Bochs will supply the default value.
Also, $LTDL_LIBRARY_PATH points to a list of directories (separated by colons,
if more than one) to search in for Bochs plugins. A compile-time default is
provided if this variable is not defined by the user. On Win32 and MacOSX, the
default for the share directory is determined by a platform-specific specific
algorithm. On Win32, we use the registry to see what directory Bochs and its
support files were installed in. On MacOSX, the share directory is the directory
where the application is located.
Also, $LTDL_LIBRARY_PATH points to a list of directories to search in for Bochs
plugins. The paths are separated by colons (on Windows: semicolons).
A compile-time default is provided if this variable is not defined by the user.
On Win32 and MacOSX, the default for the share directory is determined by a
platform-specific specific algorithm. On Win32, we use the registry to see what
directory Bochs and its support files were installed in. On MacOSX, the share
directory is the directory where the application is located.
</para>
<para>

View File

@ -367,6 +367,9 @@ void plugin_fini_all (void)
void plugin_load(char *name, char *args, plugintype_t type)
{
plugin_t *plugin, *temp;
#if defined(_MSC_VER)
char dll_path[MAX_PATH];
#endif
if (plugins != NULL) {
temp = plugins;
@ -402,9 +405,15 @@ void plugin_load(char *name, char *args, plugintype_t type)
current_plugin_context = plugin;
#if defined(_MSC_VER)
plugin->handle = LoadLibrary(plugin_filename);
if (!plugin->handle) {
if (GetEnvironmentVariable("LTDL_LIBRARY_PATH", dll_path, MAX_PATH)) {
strcat(dll_path, "\\");
strcat(dll_path, plugin_filename);
plugin->handle = LoadLibrary(dll_path);
}
}
BX_INFO(("DLL handle is %p", plugin->handle));
if (!plugin->handle)
{
if (!plugin->handle) {
current_plugin_context = NULL;
BX_PANIC(("LoadLibrary failed for module '%s': error=%d", name, GetLastError()));
free(plugin);