diff options
author | Larry Wall <lwall@netlabs.com> | 1994-05-04 23:00:00 +0000 |
---|---|---|
committer | Larry Wall <lwall@netlabs.com> | 1994-05-04 23:00:00 +0000 |
commit | 85e6fe838fb25b257a1b363debf8691c0992ef71 (patch) | |
tree | fd5340cd6c3bbabfc21d3b0cac48e7ab3a481ebf /dl_sunos.c | |
parent | 2304df62caa7d9be70e8b8bcdb454e139c9c103d (diff) | |
download | perl-5a9.tar.gz |
perl 5.0 alpha 9perl-5a9
[editor's note: the sparc executables have not been included,
and emacs backup files have been removed]
Diffstat (limited to 'dl_sunos.c')
-rw-r--r-- | dl_sunos.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dl_sunos.c b/dl_sunos.c new file mode 100644 index 0000000000..badd66d678 --- /dev/null +++ b/dl_sunos.c @@ -0,0 +1,56 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifdef I_DLFCN +# include <dlfcn.h> +#endif + +static int +XS_DynamicLoader_bootstrap(ix, ax, items) +register int ix; +register int ax; +register int items; +{ + if (items < 1 || items > 1) { + croak("Usage: DynamicLoader::bootstrap(package)"); + } + { + char* package = SvPV(ST(1),na); + void* obj = 0; + int (*bootproc)(); + char tmpbuf[1024]; + char tmpbuf2[128]; + AV *av = GvAVn(incgv); + I32 i; + + for (i = 0; i <= AvFILL(av); i++) { + (void)sprintf(tmpbuf, "%s/auto/%s/%s.so", + SvPVx(*av_fetch(av, i, TRUE), na), package, package); + if (obj = dlopen(tmpbuf,1)) + break; + } + if (!obj) + croak("Can't find loadable object for package %s in @INC", package); + + sprintf(tmpbuf2, "boot_%s", package); + bootproc = (int (*)())dlsym(obj, tmpbuf2); + if (!bootproc) + croak("Shared object %s contains no %s function", tmpbuf, tmpbuf2); + bootproc(); + + ST(0) = sv_mortalcopy(&sv_yes); + } + return ax; +} + +int +boot_DynamicLoader(ix,sp,items) +int ix; +int sp; +int items; +{ + char* file = __FILE__; + + newXSUB("DynamicLoader::bootstrap", 0, XS_DynamicLoader_bootstrap, file); +} |