<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.ffi.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'ffi.load.php',
    1 => 'FFI::load',
    2 => 'C のヘッダーファイルから C の宣言を読み込む',
  ),
  'up' => 
  array (
    0 => 'class.ffi.php',
    1 => 'FFI',
  ),
  'prev' => 
  array (
    0 => 'ffi.isnull.php',
    1 => 'FFI::isNull',
  ),
  'next' => 
  array (
    0 => 'ffi.memcmp.php',
    1 => 'FFI::memcmp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/ffi/ffi/load.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ffi.load" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">FFI::load</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.4.0, PHP 8)</p><p class="refpurpose"><span class="refname">FFI::load</span> &mdash; <span class="dc-title">C のヘッダーファイルから C の宣言を読み込む</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ffi.load-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>FFI::load</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.ffi.php" class="type FFI">FFI</a></span></span></div>

  <p class="simpara">
   C のヘッダーファイルから C の宣言を読み込みます。
   読み込まれる C のヘッダーファイル内で特殊な define <code class="literal">FFI_LIB</code> を使うことで、
   読み込む共有ライブラリを指定することが可能です。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-ffi.load-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      C のヘッダーファイル名。
     </span>
     <span class="simpara">
      C のプリプロセッサーディレクティブはサポートされていません。
      例えば、<code class="code">#include</code> や <code class="code">#define</code>、プリプロセッサーマクロは動作しません。
      ただし、次に挙げる特殊な場合を除きます。
     </span>
     <span class="simpara">
      このヘッダーファイルでは、<code class="literal">#define</code> 文で
      <code class="literal">FFI_SCOPE</code> 変数を定義<em>すべき</em>です
      (例: <code class="code">#define FFI_SCOPE &quot;MYLIB&quot;</code>)。
      詳しくは <a href="class.ffi.php#ffi.intro" class="link">FFI クラスの概要</a> を参照してください。
     </span>
     <span class="simpara">
      このヘッダーファイルでは、<code class="literal">#define</code> 文で
      <code class="literal">FFI_LIB</code> 変数を定義することで、公開するライブラリを指定<em>しても構いません</em>。
      それがシステムライブラリなら、必要なのはファイル名だけです (例: <code class="code">#define FFI_LIB
      &quot;libc.so.6&quot;</code>)。カスタムライブラリなら、相対パスが必要です
      (例: <code class="code">#define FFI_LIB &quot;./mylib.so&quot;</code>)。
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-ffi.load-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="simpara">
   新しく作成された <span class="classname"><a href="class.ffi.php" class="classname">FFI</a></span> オブジェクトを返します。
   失敗時には <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-ffi.load-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       現在のシステムユーザが <code class="literal">opcache.preload_user</code>
       設定ディレクティブで定義されたユーザと同じである場合、
       <a href="opcache.preloading.php" class="link">事前ロードスクリプト</a> の中で
       <span class="methodname"><strong>FFI::load()</strong></span> を呼べるようになりました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-ffi.load-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="ffi.scope.php" class="methodname" rel="rdfs-seeAlso">FFI::scope()</a> - 事前ロード中にパースされた C の宣言を使って FFI オブジェクトをインスタンス化する</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>