diff --git a/src/core/pluginloader.c b/src/core/pluginloader.c index c0fef87..cb0b016 100644 --- a/src/core/pluginloader.c +++ b/src/core/pluginloader.c @@ -44,7 +44,7 @@ struct uhub_plugin* plugin_open(const char* filename) #ifdef HAVE_DLOPEN LOG_ERROR("Unable to open plugin %s: %s", filename, dlerror()); #else - LOG_ERROR("Unable to open plugin %s: %s", filename, GetLastError()); + LOG_ERROR("Unable to open plugin %s: %d", filename, GetLastError()); #endif hub_free(plugin); return 0; diff --git a/src/plugin_api/handle.h b/src/plugin_api/handle.h index 9096cae..991d463 100644 --- a/src/plugin_api/handle.h +++ b/src/plugin_api/handle.h @@ -193,12 +193,12 @@ struct plugin_handle * @param config A configuration string * @return 0 on success, -1 on error. */ -extern int plugin_register(struct plugin_handle* handle, const char* config); +PLUGIN_API int plugin_register(struct plugin_handle* handle, const char* config); /** * @return 0 on success, -1 on error. */ -extern int plugin_unregister(struct plugin_handle*); +PLUGIN_API int plugin_unregister(struct plugin_handle*); typedef int (*plugin_register_f)(struct plugin_handle* handle, const char* config); typedef int (*plugin_unregister_f)(struct plugin_handle*); diff --git a/src/plugins/mod_auth_simple.c b/src/plugins/mod_auth_simple.c index f5b712d..7af92f9 100644 --- a/src/plugins/mod_auth_simple.c +++ b/src/plugins/mod_auth_simple.c @@ -203,7 +203,7 @@ static plugin_st delete_user(struct plugin_handle* plugin, struct auth_info* use return st_default; } -int plugin_register(struct plugin_handle* plugin, const char* config) +PLUGIN_API int plugin_register(struct plugin_handle* plugin, const char* config) { PLUGIN_INITIALIZE(plugin, "File authentication plugin", "0.1", "Authenticate users based on a read-only text file."); @@ -219,7 +219,7 @@ int plugin_register(struct plugin_handle* plugin, const char* config) return -1; } -int plugin_unregister(struct plugin_handle* plugin) +PLUGIN_API int plugin_unregister(struct plugin_handle* plugin) { set_error_message(plugin, 0); unload_acl(plugin->ptr); diff --git a/src/system.h b/src/system.h index a909fd0..3078460 100644 --- a/src/system.h +++ b/src/system.h @@ -256,4 +256,9 @@ typedef unsigned __int64 uint64_t; #define NEED_GETOPT #endif +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER) +#define PLUGIN_API __declspec(dllexport) +#else +#define PLUGIN_API +#endif #endif /* HAVE_UHUB_SYSTEM_H */