Minor cleanup & ensure the plugin API is C compatible

This commit is contained in:
Duncan Ogilvie 2024-03-04 01:28:00 +01:00
parent f518e507c2
commit 48dde167f3
9 changed files with 28 additions and 10 deletions

View File

@ -1,14 +1,14 @@
#ifndef _BRIDGEMAIN_H_
#define _BRIDGEMAIN_H_
#include <windows.h>
#include <Windows.h>
#ifndef __cplusplus
#include <stdbool.h>
#define DEFAULT_PARAM(name, value) name
#else
#define DEFAULT_PARAM(name, value) name = value
#endif
#endif // __cplusplus
//default structure alignments forced
#ifdef _WIN64
@ -36,7 +36,7 @@ typedef signed long dsint;
#ifdef __cplusplus
extern "C"
{
#endif
#endif // __cplusplus
//Bridge defines
#define MAX_SETTING_SIZE 65536
@ -147,7 +147,7 @@ BRIDGE_IMPEXP const wchar_t* BridgeUserDirectory();
#ifdef __cplusplus
}
#endif
#endif // __cplusplus
//list structure (and C++ wrapper)
#include "bridgelist.h"
@ -157,7 +157,7 @@ BRIDGE_IMPEXP const wchar_t* BridgeUserDirectory();
#ifdef __cplusplus
extern "C"
{
#endif
#endif // __cplusplus
//Debugger defines
#define MAX_LABEL_SIZE 256
@ -1477,7 +1477,7 @@ BRIDGE_IMPEXP DWORD GuiGetMainThreadId();
#ifdef __cplusplus
}
#endif
#endif // __cplusplus
// Some useful C++ wrapper classes
#ifdef __cplusplus

7
src/dbg/_apichecker.c Normal file
View File

@ -0,0 +1,7 @@
// HACK: pretend we are in the same environment as a plugin
//#define PLUG_IMPEXP
#ifdef BUILD_DBG
#undef BUILD_DBG
#endif // BUILD_DBG
#include "_plugins.h"

View File

@ -3,7 +3,6 @@
\brief Implements the global class.
*/
#include <windows.h>
#include "_global.h"
#include <objbase.h>
#include <shlobj.h>

View File

@ -12,12 +12,14 @@
#else
#include <Windows.h>
#ifdef __GNUC__
#include "dbghelp/dbghelp.h"
#else
#pragma warning(push)
#pragma warning(disable:4091)
#include <dbghelp.h>
#include <DbgHelp.h>
#pragma warning(pop)
#endif // __GNUC__

View File

@ -163,7 +163,7 @@ bool _plugin_registerexprfunction(int pluginHandle, const char* name, int argc,
return pluginexprfuncregister(pluginHandle, name, argc, cbFunction, userdata);
}
bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, const ValueType & returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata)
bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, ValueType returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata)
{
return pluginexprfuncregisterex(pluginHandle, name, returnType, argTypes, argCount, cbFunction, userdata);
}

View File

@ -348,7 +348,7 @@ PLUG_IMPEXP bool _plugin_menuentryremove(int pluginHandle, int hEntry);
PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript);
PLUG_IMPEXP bool _plugin_waituntilpaused();
PLUG_IMPEXP bool _plugin_registerexprfunction(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata);
PLUG_IMPEXP bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, const ValueType & returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata);
PLUG_IMPEXP bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, ValueType returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata);
PLUG_IMPEXP bool _plugin_unregisterexprfunction(int pluginHandle, const char* name);
PLUG_IMPEXP bool _plugin_unload(const char* pluginName);
PLUG_IMPEXP bool _plugin_load(const char* pluginName);

2
src/dbg/bridgemain.h Normal file
View File

@ -0,0 +1,2 @@
// NOTE: this file is only here to make _apichecker.c compile
#include "../bridge/bridgemain.h"

View File

@ -114,6 +114,7 @@
<ClCompile Include="WinInet-Downloader\downslib.cpp" />
<ClCompile Include="x64dbg.cpp" />
<ClCompile Include="xrefs.cpp" />
<ClCompile Include="_apichecker.c" />
<ClCompile Include="_exports.cpp" />
<ClCompile Include="_dbgfunctions.cpp" />
<ClCompile Include="_global.cpp" />
@ -155,6 +156,7 @@
<ClInclude Include="assemble.h" />
<ClInclude Include="bookmark.h" />
<ClInclude Include="breakpoint.h" />
<ClInclude Include="bridgemain.h" />
<ClInclude Include="btparser\btparser\ast.h" />
<ClInclude Include="btparser\btparser\helpers.h" />
<ClInclude Include="btparser\btparser\keywords.h" />

View File

@ -458,6 +458,9 @@
<ClCompile Include="symbolsourcebase.cpp">
<Filter>Source Files\Symbols</Filter>
</ClCompile>
<ClCompile Include="_apichecker.c">
<Filter>Source Files\Interfaces/Exports</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dbghelp\dbghelp.h">
@ -898,5 +901,8 @@
<ClInclude Include="LLVMDemangle\LLVMDemangle.h">
<Filter>Header Files\Third Party\LLVMDemangle</Filter>
</ClInclude>
<ClInclude Include="bridgemain.h">
<Filter>Header Files\Interfaces/Exports</Filter>
</ClInclude>
</ItemGroup>
</Project>