Permalink
Browse files

dlsym the functions we need after use Glib and before use BarnOwl

After use Glib so the library is loaded. Before use BarnOwl so we try to
use them before they're available.
  • Loading branch information...
1 parent 897fc1c commit e5210c98551ad1835a4e926515106b3e2f04eab8 @davidben davidben committed Jun 10, 2012
Showing with 11 additions and 11 deletions.
  1. +0 −11 owl.c
  2. +11 −0 perlconfig.c
View
11 owl.c
@@ -477,7 +477,6 @@ int main(int argc, char **argv, char **env)
int argc_copy;
char **argv_copy;
char *perlout, *perlerr;
- const char *dlerr;
const owl_style *s;
const char *dir;
owl_options opts;
@@ -554,16 +553,6 @@ int main(int argc, char **argv, char **env)
exit(1);
}
- dlerr = owl_closure_init();
- if(dlerr) {
- endwin();
- fprintf(stderr, "Error binding gtk2-perl functions from C: %s\n",dlerr);
- fflush(stderr);
- fprintf(stdout, "Error binding gtk2-perl functions from C: %s\n",dlerr);
- fflush(stdout);
- exit(1);
- }
-
owl_global_complete_setup(&g);
owl_global_setup_default_filters(&g);
View
@@ -330,6 +330,7 @@ CALLER_OWN char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***P
PerlInterpreter *p;
char *err;
const char *args[4] = {"", "-e", "0;", NULL};
+ const char *dlerr;
AV *inc;
char *path;
@@ -387,6 +388,16 @@ CALLER_OWN char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***P
av_store(inc, 0, owl_new_sv(path));
g_free(path);
+ /* Load up perl-Glib. */
+ eval_pv("use Glib;", FALSE);
+
+ /* Now, before BarnOwl tries to use them, get the relevant function pointers out. */
+ dlerr = owl_closure_init();
+ if (dlerr) {
+ return g_strdup(dlerr);
+ }
+
+ /* And now it's safe to import BarnOwl. */
eval_pv("use BarnOwl;", FALSE);
if (SvTRUE(ERRSV)) {

0 comments on commit e5210c9

Please sign in to comment.