1 ?RCS: $Id: d_dlsymun.U,v $
3 ?RCS: Copyright (c) 1996-1998, Andy Dougherty
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
8 ?RCS: $Log: d_dlsymun.U,v $
11 ?MAKE:d_dlsymun: cat cc ccflags ldflags ld rm Setvar dlsrc i_dlfcn \
12 cccdlflags ccdlflags lddlflags libs dlext _o
13 ?MAKE: -pick add $@ %<
14 ?X: This is specific to perl5.
16 ?S: This variable conditionally defines DLSYM_NEEDS_UNDERSCORE, which
17 ?S: indicates that we need to prepend an underscore to the symbol
18 ?S: name before calling dlsym().
20 ?C:DLSYM_NEEDS_UNDERSCORE:
21 ?C: This symbol, if defined, indicates that we need to prepend an
22 ?C: underscore to the symbol name before calling dlsym(). This only
23 ?C: makes sense if you *have* dlsym, which we will presume is the
24 ?C: case if you're using dl_dlopen.xs.
26 ?H:#$d_dlsymun DLSYM_NEEDS_UNDERSCORE /**/
31 : Check if dlsym need a leading underscore
37 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
47 #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
49 #include <sys/types.h>
63 int mode = RTLD_LAZY ;
65 handle = dlopen("./dyna.$dlext", mode) ;
71 symbol = dlsym(handle, "fred") ;
73 /* try putting a leading underscore */
74 symbol = dlsym(handle, "_fred") ;
88 : Call the object file tmp-dyna.o in case dlext=o.
89 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
90 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
91 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
92 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
95 1) echo "Test program failed using dlopen." >&4
96 echo "Perhaps you should not use dynamic loading." >&4;;
97 2) echo "Test program failed using dlsym." >&4
98 echo "Perhaps you should not use dynamic loading." >&4;;
99 3) echo "dlsym needs a leading underscore" >&4
101 4) echo "dlsym doesn't need a leading underscore." >&4;;
104 echo "I can't compile and run the test program." >&4
105 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
110 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?