Some work on the Bochs plugins support.
- Improved macro definitions for plugin entry points. - Forward declarations of plugin entry points are only required when plugin support is off. - Improved panic message for the case when plugin entry point is not found.
This commit is contained in:
parent
74deb16b44
commit
3f760e2900
@ -573,8 +573,8 @@ enum {
|
||||
// static bx_sdl_gui_c *theGui;
|
||||
|
||||
#define IMPLEMENT_GUI_PLUGIN_CODE(gui_name) \
|
||||
int CDECL lib##gui_name##_gui_plugin_entry(plugin_t *plugin, \
|
||||
plugintype_t type, bool init) { \
|
||||
PLUGIN_ENTRY_FOR_GUI_MODULE(gui_name) \
|
||||
{ \
|
||||
if (init) { \
|
||||
genlog->info("installing %s module as the Bochs GUI", #gui_name); \
|
||||
theGui = new bx_##gui_name##_gui_c (); \
|
||||
|
@ -24,7 +24,7 @@ Detailed description:
|
||||
Patch was created with:
|
||||
diff -u
|
||||
Apply patch to what version:
|
||||
svn revision 14082 (Jan 24, 2021)
|
||||
svn revision 14083 (Jan 24, 2021)
|
||||
Instructions:
|
||||
To patch, go to main bochs directory.
|
||||
Type "patch -p0 < THIS_PATCH_FILE".
|
||||
@ -215,7 +215,7 @@ diff -urN ../bochs/user_plugins/testdev.cc ./user_plugins/testdev.cc
|
||||
+
|
||||
+// device plugin entry point
|
||||
+
|
||||
+extern "C" PLUGIN_ENTRY_FOR_MODULE(testdev)
|
||||
+PLUGIN_ENTRY_FOR_MODULE(testdev)
|
||||
+{
|
||||
+ if (init) {
|
||||
+ theTestDevice = new bx_testdev_c();
|
||||
|
@ -556,14 +556,16 @@ bool plugin_load(const char *name, plugintype_t type)
|
||||
#if defined(WIN32)
|
||||
plugin->plugin_entry = (plugin_entry_t) GetProcAddress(plugin->handle, tmpname);
|
||||
if (plugin->plugin_entry == NULL) {
|
||||
pluginlog->panic("could not find plugin_entry: error=%d", GetLastError());
|
||||
pluginlog->panic("could not find plugin_entry for module '%s' (%s): error=%d",
|
||||
name, plugin_filename, GetLastError());
|
||||
plugin_abort(plugin);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
plugin->plugin_entry = (plugin_entry_t) lt_dlsym(plugin->handle, tmpname);
|
||||
if (plugin->plugin_entry == NULL) {
|
||||
pluginlog->panic("could not find plugin_entry: %s", lt_dlerror());
|
||||
pluginlog->panic("could not find plugin_entry for module '%s' (%s): %s",
|
||||
name, plugin_filename, lt_dlerror());
|
||||
plugin_abort(plugin);
|
||||
return 0;
|
||||
}
|
||||
|
@ -358,7 +358,8 @@ int bx_unload_opt_plugin(const char *name, bx_bool devflag);
|
||||
int plugin_entry(plugin_t *plugin, plugintype_t type, bool init);
|
||||
|
||||
// still in extern "C"
|
||||
#if BX_PLUGINS && defined(_MSC_VER)
|
||||
#if BX_PLUGINS && defined(WIN32)
|
||||
|
||||
#define PLUGIN_ENTRY_FOR_MODULE(mod) \
|
||||
extern "C" __declspec(dllexport) int __cdecl lib##mod##_LTX_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
|
||||
@ -371,7 +372,24 @@ int plugin_entry(plugin_t *plugin, plugintype_t type, bool init);
|
||||
extern "C" __declspec(dllexport) int __cdecl lib##mod##_dev_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
|
||||
extern "C" __declspec(dllexport) int __cdecl lib##mod##_img_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
|
||||
#elif BX_PLUGINS
|
||||
|
||||
#define PLUGIN_ENTRY_FOR_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_LTX_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_gui_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_SOUND_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_sound_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_NET_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_net_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_USB_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_dev_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
|
||||
extern "C" int CDECL lib##mod##_img_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
|
||||
#else
|
||||
|
||||
#define PLUGIN_ENTRY_FOR_MODULE(mod) \
|
||||
int CDECL lib##mod##_LTX_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_GUI_MODULE(mod) \
|
||||
@ -384,7 +402,6 @@ int plugin_entry(plugin_t *plugin, plugintype_t type, bool init);
|
||||
int CDECL lib##mod##_dev_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#define PLUGIN_ENTRY_FOR_IMG_MODULE(mod) \
|
||||
int CDECL lib##mod##_img_plugin_entry(plugin_t *plugin, plugintype_t type, bool init)
|
||||
#endif
|
||||
|
||||
// device plugins
|
||||
PLUGIN_ENTRY_FOR_MODULE(harddrv);
|
||||
@ -468,6 +485,7 @@ PLUGIN_ENTRY_FOR_IMG_MODULE(vbox);
|
||||
PLUGIN_ENTRY_FOR_IMG_MODULE(vpc);
|
||||
PLUGIN_ENTRY_FOR_IMG_MODULE(vvfat);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user