Skip to content

Compiled assembly

Structure of generated assembly#

The compiler outputs portable class libraries or executables compatible with .NET 4.5, Mono and .NET Core.

  • namespace -
    • class <Script>
      • Main(string[] args) : int
      • EnumerateConstants(Action<string, PhpValue, bool> callback)
      • EnumerateReferencedFunctions(Action<string, RuntimeMethodHandle> callback)
      • EnumerateReferencedTypes(Action<string, RuntimeTypeHandle> callback)
      • EnumerateScripts(Action<string, RuntimeMethodHandle> callback)
  • namespace NS1
    • class Class1
  • namespace <Root>
    • [Script("file1.php")] static class file1_php
      • <Main>(Context <ctx>, PhpArray <locals>, object this, RuntimeTypeHandle self) : T
      • function1(Context <ctx>, ...) : T

Declarations are compiled into the assembly as depicted above.

  • Script files (file1.php) are represented by the respective class in namespace <Root>. The script body is represented by the static method <Main>.

  • Global functions (function1) are compiled as static methods in their script file class. Conditionally declared functions contain a suffix.

  • Classes and interfaces (class1) are compiled into the same structure as defined.