2 * dl_beos.xs, by Tom Spindler
3 * based on dl_dlopen.xs, by Paul Marquess
11 #include <be/kernel/image.h>
16 #define dlerror() strerror(errno)
18 #include "dlutils.c" /* SaveError() etc */
23 (void)dl_generic_private_init();
26 MODULE = DynaLoader PACKAGE = DynaLoader
29 (void)dl_private_init();
33 dl_load_file(filename, flags=0)
39 path = malloc(PATH_MAX);
40 if (*filename != '/') {
41 getcwd(path, PATH_MAX);
43 strcat(path, filename);
45 strcpy(path, filename);
48 DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s,%x):\n", path, flags));
49 bogo = load_add_on(path);
50 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%lx\n", (unsigned long) RETVAL));
51 ST(0) = sv_newmortal() ;
53 SaveError("%s", strerror(bogo));
54 fprintf(stderr, "load_add_on(%s) : %d (%s)\n", path, bogo, strerror(bogo));
56 RETVAL = (void *) bogo;
57 sv_setiv( ST(0), (IV)RETVAL);
63 dl_find_symbol(libhandle, symbolname)
69 #ifdef DLSYM_NEEDS_UNDERSCORE
70 symbolname = form("_%s", symbolname);
73 DLDEBUG(2, PerlIO_printf(PerlIO_stderr(),
74 "dl_find_symbol(handle=%lx, symbol=%s)\n",
75 (unsigned long) libhandle, symbolname));
76 retcode = get_image_symbol((image_id) libhandle, symbolname,
77 B_SYMBOL_TYPE_TEXT, (void **) &adr);
79 DLDEBUG(2, PerlIO_printf(PerlIO_stderr(),
80 " symbolref = %lx\n", (unsigned long) RETVAL));
81 ST(0) = sv_newmortal() ;
83 SaveError("%s", strerror(retcode)) ;
84 fprintf(stderr, "retcode = %p (%s)\n", retcode, strerror(retcode));
86 sv_setiv( ST(0), (IV)RETVAL);
95 # These functions should not need changing on any platform:
98 dl_install_xsub(perl_name, symref, filename="$Package")
103 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), "dl_install_xsub(name=%s, symref=%lx)\n",
104 perl_name, (unsigned long) symref));
105 ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)_((CV *)))symref, filename)));