diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 91ea5de..b689ba6 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2716,7 +2716,7 @@ static XS (XS_weechat_info_get)
}
/*
- * weechat_perl_xs_init: initialize subroutines
+ * weechat_perl_api_init: initialize subroutines
*/
void
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 4887436..c843ca7 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -117,7 +117,7 @@ weechat_perl_exec (struct t_plugin_script *script,
dSP;
#ifndef MULTIPLICITY
- int length = strlen (script->interpreter) + strlen (function) + 3;
+ length = strlen (script->interpreter) + strlen (function) + 3;
func = (char *)malloc (length * sizeof (char));
if (!func)
return NULL;
@@ -247,9 +247,6 @@ weechat_perl_load (char *filename)
perl_argv[0] = filename;
perl_argv[1] = pkgname;
perl_argv[2] = NULL;
- eval = weechat_perl_exec (plugin, &tempscript,
- WEECHAT_SCRIPT_EXEC_INT,
- "weechat_perl_load_eval_file", perl_argv);
#else
perl_current_interpreter = perl_alloc();
@@ -273,11 +270,11 @@ weechat_perl_load (char *filename)
eval_pv (perl_weechat_code, TRUE);
perl_argv[0] = filename;
perl_argv[1] = NULL;
+#endif
eval = weechat_perl_exec (&tempscript,
WEECHAT_SCRIPT_EXEC_INT,
"weechat_perl_load_eval_file",
perl_argv);
-#endif
if (!eval)
{
weechat_printf (NULL,
@@ -595,7 +592,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
}
perl_construct (perl_main);
- perl_parse (perl_main, weechat_perl_xs_init, 3, perl_args, NULL);
+ perl_parse (perl_main, weechat_perl_api_init, 3, perl_args, NULL);
eval_pv (perl_weechat_code, TRUE);
#endif
@@ -613,7 +610,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
* weechat_plugin_end: end Perl plugin
*/
-void
+int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
@@ -631,4 +628,5 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
perl_main = NULL;
}
#endif
+ return WEECHAT_RC_OK;
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index b117cb9..101ab35 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -649,7 +649,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
* weechat_plugin_end: shutdown Python interface
*/
-void
+int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
@@ -673,5 +673,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to free interpreter"),
weechat_prefix ("error"), "python");
+ return WEECHAT_RC_ERROR;
}
+ return WEECHAT_RC_OK;
}
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 91112eb..b381b27 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -23,20 +23,30 @@
#include <sys/types.h>
+#ifdef __cplusplus
+# define BEGIN_CDECL extern "C" {
+# define END_CDECL }
+#else
+# define BEGIN_CDECL
+# define END_CDECL
+#endif
+
+BEGIN_CDECL
+
struct t_gui_buffer;
struct t_weelist;
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
- char weechat_plugin_name[] = __name;
+ BEGIN_CDECL char weechat_plugin_name[] = __name; END_CDECL
#define WEECHAT_PLUGIN_AUTHOR(__author) \
- char weechat_plugin_author[] = __author;
+ BEGIN_CDECL char weechat_plugin_author[] = __author; END_CDECL
#define WEECHAT_PLUGIN_DESCRIPTION(__desc) \
- char weechat_plugin_description[] = __desc;
+ BEGIN_CDECL char weechat_plugin_description[] = __desc; END_CDECL
#define WEECHAT_PLUGIN_VERSION(__version) \
- char weechat_plugin_version[] = __version;
+ BEGIN_CDECL char weechat_plugin_version[] = __version; END_CDECL
#define WEECHAT_PLUGIN_LICENSE(__license) \
- char weechat_plugin_license[] = __license;
+ BEGIN_CDECL char weechat_plugin_license[] = __license; END_CDECL
/* return codes for plugin functions */
#define WEECHAT_RC_ERROR -1 /* function failed with an error */
@@ -340,6 +350,9 @@ struct t_weechat_plugin
/* WeeChat developers: ALWAYS add new functions at the end */
};
+int weechat_plugin_init (struct t_weechat_plugin *plugin);
+int weechat_plugin_end (struct t_weechat_plugin *plugin);
+
/* macros for easy call to plugin API */
/* strings */
@@ -654,4 +667,6 @@ struct t_weechat_plugin
#define weechat_infolist_free(__list) \
weechat_plugin->infolist_free(__list)
+END_CDECL
+
#endif /* weechat-plugin.h */