Skip to content

Commit e875fc9

Browse files
committed
Fix Windows DLL symbol export for plugin_run
- Add WHATSMY_PLUGIN_EXPORT macro with __declspec(dllexport) for Windows - Fixes 'plugin_run not found' error when loading plugins on Windows - Linux and macOS plugins continue to work as before - Plugin now properly exports symbols on all platforms
1 parent 559181c commit e875fc9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

plugin.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ std::string get_system_info() {
8585
* whatsmy example John -> argc=2, argv[0]="example", argv[1]="John"
8686
* whatsmy example foo bar -> argc=3, argv[0]="example", argv[1]="foo", argv[2]="bar"
8787
*/
88+
89+
// Windows DLL export macro
90+
#ifdef _WIN32
91+
#define WHATSMY_PLUGIN_EXPORT __declspec(dllexport)
92+
#else
93+
#define WHATSMY_PLUGIN_EXPORT
94+
#endif
95+
8896
extern "C" {
89-
int plugin_run(int argc, char* argv[]) {
97+
WHATSMY_PLUGIN_EXPORT int plugin_run(int argc, char* argv[]) {
9098
try {
9199
// Print plugin information
92100
std::cout << "==================================" << std::endl;

0 commit comments

Comments
 (0)