|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <!-- $Revision$ --> |
3 | | -<!-- EN-Revision: 46a9cdd2dbef4ec89bf65fad9930e2feb78bbb98 Maintainer: nsfisis Status: working --> |
| 3 | +<!-- EN-Revision: 46a9cdd2dbef4ec89bf65fad9930e2feb78bbb98 Maintainer: nsfisis Status: ready --> |
4 | 4 |
|
5 | 5 | <book xml:id="book.ffi" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
6 | 6 | <?phpdoc extension-membership="bundled" ?> |
7 | | - <title>Foreign Function Interface</title> |
| 7 | + <title>外部関数インターフェース</title> |
8 | 8 | <titleabbrev>FFI</titleabbrev> |
9 | 9 |
|
10 | 10 | <preface xml:id="intro.ffi"> |
11 | 11 | &reftitle.intro; |
12 | 12 | <para> |
13 | | - This extension allows the loading of shared libraries (<filename>.DLL</filename> or |
14 | | - <filename>.so</filename>), calling of C functions and accessing of C data structures |
15 | | - in pure PHP, without having to have deep knowledge of the Zend extension API, and |
16 | | - without having to learn a third “intermediate” language. |
17 | | - The public API is implemented as a single class <classname>FFI</classname> with |
18 | | - several static methods (some of them may be called dynamically), and overloaded object |
19 | | - methods, which perform the actual interaction with C data. |
| 13 | + この拡張は、Zend 拡張 API の深い知識が無くとも、あるいは第三の中間言語を学ぶことをせずとも、 |
| 14 | + 純粋な PHP で共有ライブラリ (<filename>.DLL</filename> または <filename>.so</filename>) |
| 15 | + を読み込んだり、C の関数を呼び出したり、C のデータ構造にアクセスしたりすることを |
| 16 | + 可能とします。 |
| 17 | + 公開 API は単一のクラス <classname>FFI</classname> として実装されています。 |
| 18 | + このクラスの静的メソッド (そのうちのいくつかは非静的メソッドとしても呼び出せます) や |
| 19 | + オーバーロードされたオブジェクトメソッドが、実際の C のデータとのやり取りを行います。 |
20 | 20 | </para> |
21 | 21 | <caution> |
22 | 22 | <para> |
23 | | - FFI is dangerous, since it allows to interface with the system on a very low level. |
24 | | - The FFI extension should only be used by developers having a working knowledge of C |
25 | | - and the used C APIs. To minimize the risk, the FFI API usage may be restricted |
26 | | - with the <link linkend="ini.ffi.enable">ffi.enable</link> &php.ini; directive. |
| 23 | + FFI は、システムと低レベルでやり取りできるため危険です。 |
| 24 | + FFI 拡張は、C 言語と使われる C の API についての実用的な知識を持つ開発者のみによって |
| 25 | + 用いられるべきです。リスクを最小化するため、FFI API の使用は |
| 26 | + <link linkend="ini.ffi.enable">ffi.enable</link> &php.ini; ディレクティブによって制限できます。 |
27 | 27 | </para> |
28 | 28 | </caution> |
29 | 29 | <note> |
30 | 30 | <para> |
31 | | - The FFI extension does not render the classic PHP extension API obsolete; it is merely |
32 | | - provided for ad-hoc interfacing with C functions and data structures. |
| 31 | + FFI 拡張は、古くからある PHP 拡張の API を廃止しようとしているわけではありません。 |
| 32 | + これは C の関数やデータ構造へのアドホックなインターフェースを提供するにすぎないのです。 |
33 | 33 | </para> |
34 | 34 | </note> |
35 | 35 | <tip> |
36 | 36 | <para> |
37 | | - Currently, accessing FFI data structures is significantly (about 2 times) slower |
38 | | - than accessing native PHP arrays and objects. Therefore, it makes no sense to use |
39 | | - the FFI extension for speed; however, it may make sense to use it to reduce memory |
40 | | - consumption. |
| 37 | + 今のところ、FFI のデータ構造へのアクセスは、ネイティブな PHP の配列やオブジェクトへのアクセスと比べて |
| 38 | + 非常に (約 2 倍) 低速です。したがって、速度のために FFI 拡張を使うことには意味がありません。 |
| 39 | + しかし、メモリ消費を減らすために使うのは意味があるかもしれません。 |
41 | 40 | </para> |
42 | 41 | </tip> |
43 | 42 | </preface> |
|
0 commit comments