1996-12-13 21:32:26 +01:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test dlmodule.c
|
1996-12-16 21:25:44 +01:00
|
|
|
Roger E. Masse revised strategy by Barry Warsaw
|
1996-12-13 21:32:26 +01:00
|
|
|
"""
|
|
|
|
|
1996-12-16 21:25:44 +01:00
|
|
|
import dl
|
1996-12-20 23:36:52 +01:00
|
|
|
from test_support import verbose
|
1996-12-13 21:32:26 +01:00
|
|
|
|
1996-12-16 21:25:44 +01:00
|
|
|
sharedlibs = [
|
|
|
|
# SunOS/Solaris
|
|
|
|
('/usr/lib/libresolv.so', 'gethostent'),
|
1996-12-20 04:13:36 +01:00
|
|
|
# SGI IRIX
|
|
|
|
('/usr/lib/libm.so', 'sin'),
|
1996-12-16 21:25:44 +01:00
|
|
|
]
|
1996-12-13 21:32:26 +01:00
|
|
|
|
1996-12-16 21:25:44 +01:00
|
|
|
for s, func in sharedlibs:
|
|
|
|
try:
|
|
|
|
if verbose:
|
|
|
|
print 'trying to open:', s,
|
|
|
|
l = dl.open(s)
|
|
|
|
except dl.error:
|
|
|
|
if verbose:
|
|
|
|
print 'failed'
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
if verbose:
|
|
|
|
print 'succeeded...',
|
|
|
|
l.call(func)
|
|
|
|
l.close()
|
|
|
|
if verbose:
|
|
|
|
print 'worked!'
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
print 'Could not open any shared libraries'
|