mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@184768 c90b9560-bf6c-de11-be94-00142212c4b1
89 lines
2.9 KiB
XML
89 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
|
<refentry id="function.bcompiler-write-exe-footer">
|
|
<refnamediv>
|
|
<refname>bcompiler_write_exe_footer</refname>
|
|
<refpurpose>Writes the start pos, and sig to the end of a exe type file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>bcompiler_write_exe_footer</methodname>
|
|
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>startpos</parameter></methodparam>
|
|
</methodsynopsis>
|
|
&warn.experimental.func;
|
|
<para>
|
|
An EXE (or self executable) file consists of 3 parts,
|
|
</para>
|
|
<para>
|
|
<simplelist>
|
|
<member>
|
|
The stub (executable code, e.g. a compiled C program) that loads PHP
|
|
interpreter, bcompiler extension, stored Bytecodes and initiates a call
|
|
for the specified function (e.g. main) or class method (e.g. main::main)
|
|
</member>
|
|
<member>The Bytecodes (uncompressed only for the moment)</member>
|
|
<member>The bcompiler EXE footer</member>
|
|
</simplelist>
|
|
The <parameter>startpos</parameter> is the file position at
|
|
which the Bytecodes start, and can be obtained using ftell($fh).
|
|
</para>
|
|
<para>
|
|
To obtain a suitable stub you can compile php_embed-based stub phpe.c
|
|
located in the examples/embed directory on bcompiler's CVS.
|
|
</para>
|
|
<example>
|
|
<title><function>bcompiler_write_footer</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* creating the output file (example.exe) */
|
|
$fh = fopen("example.exe", "w");
|
|
/* 1) writing a stub (phpe.exe) */
|
|
$size = filesize("phpe.exe");
|
|
$fr = fopen("phpe.exe", "r");
|
|
fwrite($fh, fread($fr, $size), $size);
|
|
$startpos = ftell($fh);
|
|
/* 2) writing bytecodes */
|
|
bcompiler_write_header($fh);
|
|
bcompiler_write_class($fh, "myclass");
|
|
bcompiler_write_function($fh, "main");
|
|
bcompiler_write_footer($fh);
|
|
/* 3) writing EXE footer */
|
|
bcompiler_write_exe_footer($fh, $startpos);
|
|
/* closing the output file */
|
|
fclose($fh);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
See also <function>bcompiler_write_header</function>,
|
|
<function>bcompiler_write_class</function>, and
|
|
<function>bcompiler_write_footer</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|