This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients Michael.Felt
Date 2016-02-25.16:08:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456416527.39.0.0109184005772.issue26439@psf.upfronthosting.co.za>
In-reply-to
Content
Further testing...

I added an extremely simple hack in util.py so that a archive (AIX library) name got returned.

Also in this case - the     print cdll.LoadLibrary("libc.a") fails.

   +74  if os.name == "posix" and sys.platform == "darwin":
   +75      from ctypes.macholib.dyld import dyld_find as _dyld_find
   +76      def find_library(name):
   +77          possible = ['lib%s.dylib' % name,
   +78                      '%s.dylib' % name,
   +79                      '%s.framework/%s' % (name, name)]
   +80          for name in possible:
   +81              try:
   +82                  return _dyld_find(name)
   +83              except ValueError:
   +84                  continue
   +85          return None
   +86
   +87  if os.name == "posix" and sys.platform.startswith("aix"):
   +88       def find_library(name):
   +89          expr = "lib" + name + ".a"
   +90          return expr
   +91
   +92  elif os.name == "posix":
   +93      # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
   +94      import re, tempfile, errno
   +95
   +96      def _findLib_gcc(name):

  +275          else:
  +276              print cdll.LoadLibrary("libc.a")
  +277              print cdll.LoadLibrary("libm.so")
  +278              print cdll.LoadLibrary("libcrypt.so")

root@x064:[/tmp]python -m ctypes.util
libm.a
libc.a
libbz2.a
Traceback (most recent call last):
  File "/opt/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/opt/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/lib/python2.7/ctypes/util.py", line 282, in <module>
    test()
  File "/opt/lib/python2.7/ctypes/util.py", line 276, in test
    print cdll.LoadLibrary("libc.a")
  File "/opt/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/opt/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError:        0509-022 Cannot load module /usr/lib/libc.a.
        0509-103   The module has an invalid magic number.

So, what needs to be returned so that cdll.LoadLibrary could use that result? (e.g., I know that the default libm.a has no shared members on AIX 5.3 TL7 - but libc.a does (shr.o and more, but not all!).
History
Date User Action Args
2016-02-25 16:08:47Michael.Feltsetrecipients: + Michael.Felt
2016-02-25 16:08:47Michael.Feltsetmessageid: <1456416527.39.0.0109184005772.issue26439@psf.upfronthosting.co.za>
2016-02-25 16:08:47Michael.Feltlinkissue26439 messages
2016-02-25 16:08:46Michael.Feltcreate