本文共 855 字,大约阅读时间需要 2 分钟。
ocaml
I am writing a program but want to call some C functions provided in some source code or library.
我正在编写程序,但想调用某些源代码或库中提供的某些C函数。
How to achieve this? Is there any good tutorials on this?
如何实现呢? 有什么好的教程吗?
A very good that is easy to follow and understand: .
一个很好的 ,易于学习和理解: 。
A comprehensive reference manual: .
全面的参考手册: 。
One example that calls a system call from OCaml: .
从OCaml 系统调用的一个示例:从OCaml 。
If you are trying to call some Unix/ APIs, you may also check the which provides the interface to the Unix system.
如果您尝试调用某些Unix / API,则还可以检查提供与Unix系统接口的 。
An example is as follows.
一个例子如下。
UseUnix.ml:
UseUnix.ml:
open Unix;;print_string "My pid: ";;print_int (getpid ());;print_newline ();;print_newline ();;print_string "ls / -l";;print_newline ();;system "ls / -l";;
To run it:
运行它:
ocaml unix.cma UseUnix.ml
翻译自:
ocaml
转载地址:http://rqowd.baihongyu.com/