Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

JS CompileFile

このテンプレートは廃止されています。使用しないで下さい。

外部ファイルに含まれるスクリプトをコンパイルします。 Compile a script stored in an external file.

構文

JSScript * JS_CompileFile(JSContext *cx, JSObject *obj,
    const char *filename);
Name Type Description
cx JSContext * スクリプトをコンパイルするときのコンテキスト リクエストが必要。 (JS_THREADSAFE ビルドでは、呼び出し側はこの JSContext 上のリクエストでなければなりません。)
obj JSObject * スクリプトと関連付けるオブジェクトObject with which the script is associated.
filename const char * スクリプトを含むファイルの名前Name of file containing the script to compile.

解説

JS_CompileFileは、JavaScriptエンジンで実行するために外部ファイルのスクリプトをコンパイルする関数です。 <code>JS_CompileFile</code> compiles the text of script in an external file location for execution by the JS engine.

filenameは、コンパイル対象のスクリプトを含んでいるファイルの名前を引数に取ります。 <code>filename</code> is the name of the file containing the script to compile.

コンパイルが成功したとき、JS_CompileFileはコンパイル済みのスクリプトへのポインタを返値とします。失敗時にはNULLを返します。 On success, <code>JS_CompileFile</code> returns a pointer to the compiled script. Otherwise it returns <code>NULL</code>.

ファイル名でスクリプトを指定するのではなく、文字列の引数として関数に渡す場合には、JS_CompileScriptを使ってください。 To pass a script as an argument to a function rather than having to specify a file location, use <code>JS_CompileScript</code> instead.

関連項目

MXR ID で JS_CompileFile

JS_CompileScript, JS_DecompileScript, JS_DestroyScript, JS_EvaluateScript, JS_ExecuteScript

ドキュメントのタグと貢献者

 このページの貢献者: fscholz, Norihiro
 最終更新者: fscholz,