source: closures.c @ 92ffd89

release-1.10
Last change on this file since 92ffd89 was 06e04a9, checked in by David Benjamin <davidben@mit.edu>, 12 years ago
perlvariables - iteration N Later commits reworked a lot of this, but the use of GValue over void* was kept.
  • Property mode set to 100644
File size: 768 bytes
Line 
1#define OWL_PERL
2#include "owl.h"
3#include <dlfcn.h>
4#include <gperl.h>
5#include <gperl_marshal.h>
6
7gboolean (*gvalue_from_sv) (GValue * value, SV * sv) = NULL;
8SV * (*sv_from_gvalue) (const GValue * value) = NULL;
9GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap) = NULL;
10
11/* Caller does not own return value */
12const char *owl_closure_init(void)
13{
14  void *handle = NULL;
15  const char *res = "Unable to dlopen self - huh?";
16
17  handle = dlopen(NULL, RTLD_LAZY | RTLD_NOLOAD);
18  if(handle) {
19    gvalue_from_sv = dlsym(handle, "gperl_value_from_sv");
20    sv_from_gvalue = dlsym(handle, "gperl_sv_from_value");
21    perl_closure_new = dlsym(handle, "gperl_closure_new");
22    /* ... */
23    res = dlerror();
24    dlclose(handle);
25  }
26  return res;
27}
28
Note: See TracBrowser for help on using the repository browser.