Call a foreign-language function: Difference between revisions
Content added Content deleted
(→{{header|Ada}}: added C++) |
(→{{header|Python}}: add ctypes example) |
||
Line 260: | Line 260: | ||
the file <tt>mylib.cma</tt> is used for the interpreted and bytecode modes, and <tt>mylib.cmxa</tt> is for the native mode. |
the file <tt>mylib.cma</tt> is used for the interpreted and bytecode modes, and <tt>mylib.cmxa</tt> is for the native mode. |
||
=={{header|Python}}== |
|||
<lang python> |
|||
import ctypes |
|||
libc = ctypes.CDLL("/lib/libc.so.6") |
|||
libc.strcmp("abc", "def") # -1 |
|||
libc.strcmp("hello", "hello") # 0 |
|||
</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |