Made plugin loading work properly on Windows.

This commit is contained in:
Jan Vidar Krey 2011-09-08 01:00:32 +02:00
parent 0d8283930f
commit 39572c3684
4 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -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*);

View File

@ -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);

View File

@ -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 */