Why does loading the libc shared library have “'LibraryLoader' object is not callable” error?

前端 未结 1 1475
耶瑟儿~
耶瑟儿~ 2021-01-24 09:25

From https://en.wikipedia.org/wiki/Foreign_function_interface

the ctypes module can load C functions from shared libraries/DLLs on-the-fly and translate

1条回答
  •  闹比i
    闹比i (楼主)
    2021-01-24 10:25

    You're confusing lower case cdll (which is a LibraryLoader) with upper case CDLL, which is the constructor for shared libraries.

    This code will work as expected:

    libc = ctypes.CDLL("/lib/x86_64-linux-gnu/libc.so.6")
    

    0 讨论(0)
提交回复
热议问题