Capítulo 28 . Creating Extensions

Índice
Compiling Modules

Exemplo 28-1 shows the source .

Exemplo 28-1 .




Nota :

Compiling Modules

The first method should definitely be favored, since, as of PHP 4.0, this has been standardized into a sophisticated build process. The fact that it is so sophisticated is also its drawback, unfortunately - it's hard to understand at first. We'll provide a more detailed introduction to this later in the chapter, but first let's work with the default files.




































The module shown earlier in Exemplo 28-1 can be enabled with --enable-first_module or --enable-first_module=yes .

The command to compile the module simply instructs the compiler to generate position-independent code ( -fpic shouldn't be omitted) and additionally defines the constant COMPILE_DL to tell the module code that it's compiled as a dynamically loadable module (the test module above checks for this; we'll discuss it shortly). After these options, it specifies a number of standard include paths that should be used as the minimal set to compile the source files.