Python 2.5ãããctypesã¨ããã©ã¤ãã©ãªãæ¨æºã©ã¤ãã©ãªã«è¿½å ããã¾ããããã®ã©ã¤ãã©ãªã¯ãCã®é¢æ°ãPythonç¨ã«ã©ããã³ã°ãã¦ãããã©ã¤ãã©ãªã§ãPythonããCã®ã©ã¤ãã©ãªï¼.soã¨ã.aã¨ã.dllã¨ããç°å¢ã«ããï¼ä¸ã®é¢æ°ããç´æ¥ãå¼ã³åºããã¨ãã§ãã¾ãã ä¼¼ããããªä»çµã¿ã«ã¯ãSWIGããPythonã®Cæ¡å¼µã¢ã¸ã¥ã¼ã«ãªã©ãããã¾ãããctypesã¯ãããã®ä»çµã¿ã¨æ¯ã¹ãå§åçã«æ軽ãªã®ã売ãã§ãï¼ã ã¨æãã¾ãï¼ã ãã¨ãã°ãPython 2.5以ä¸ã§ããã°ãã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ãä¸ã§ã >>> from ctypes import * >>> libc = CDLL("libc.so.6") >>> libc.puts("hello ctypes") hello ctypes 13 ã®ããã«ããããªãlibcã®putsé¢æ°ãå¼ã³åºããã¨ãã§ãã¾ãï¼ã¤ã³ã¿ã©ã¯
{{#tags}}- {{label}}
{{/tags}}