Building WinBinder
In this topic you will find instructions to compile and build WinBinder using
the C source code files. If you are not a C developer you do not need to worry
about building it: Just skip this page and download the most current WinBinder
version from the WinBinder web site.
NOTES
- Text in red is temporary and it is just for
internal use.
- The instructions below are generic. We need more specific
compiler information and compiler project files, so I'll very much appreciate
if you send me corrections or updated information about this document, or
procedures for specific compilers of tools.
- This topic assumes you have installed WinBinder in your local drive.
- WinBinder should be built in two versions, one for PHP 4 and the other
one for PHP 5.
- All occurrences of C:\WinBinder below should be replaced by your
actual WinBinder installation folder, for example C:\projects\WinBinder.
- All occurrences of C:\lcc below should be replaced by your
actual compiler folder, for example C:\Compilers\MinGWStudio\MinGW\.
Supported compilers
WinBinder is coded in standard ANSI C, so any ANSI C compiler for Windows should work.
The following ones have been tested.
- LCC-Win32
- C compiler by Jacob Navia (freeware). Successful. This is currently
the primary compiler for WinBinder (about to change).
- MinGW - Windows port
of GCC compiler by mingw.org (open
source) Partially successful
- Visual-MinGW
- IDE to MinGW compiler by Manu B. (open source) Partially
successful
- Dev-C++
- IDE for MinGW compiler by Bloodshed software (open source) Not
tested
- Digital Mars
- Not tested
- Pelles C
- C compiler with IDE by Pelle Orinius (freeware) Partially
successful
- Microsoft Visual Studio -
Successful
Setting up your environment
- Start your IDE and create a project called WinBinder_php4
or similar, preferably in the Tools subdirectory, using the name of your compiler and the PHP version. Example: C:\WinBinder\Tools\Lcc-win32\php4\WinBinder_php4.prj.
- Set all options necessary to build a Windows DLL, not an executable.
The DLL will be located at C:\WinBinder\php\php4\ext.
- Locate your PHP 4 header source files. If you use PHP 4 source files
uniquely for compiling WinBinder, place them at the C:\WinBinder\PHP\PHP4\source
folder. The directory that contains the headers (.H) must be added
to the include directories of your project. NOTE:
If you use the Lcc-win32 compiler you will have to use the appropriate
"tweaked" headers that can be downloaded at the WinBinder
web site, otherwise the compilation will fail. Also add to the include
list the following subdirectories (relative to the header source directory)
that contain headers: main, regex, tsrm, win32,
and zend.
- Depending on your environment, you will have to create a tool that points to the compiler
Make utility, e.g. C:\lcc\bin\make.exe. Remember to configure the tool so that its initial folder is where your makefile will
be located. This is usually in the same directory of the project file, i.e. C:\WinBinder\Tools\Lcc-win32\php4. Also assign a keyboard shortcut (like
F5 or F9) to the newly created tool so you can build
WinBinder by pressing just one key.
- If you are not using an IDE and your text editor supports regular expressions to match compilation
errors and warnings, you may enter a specific regular expression in the appropriate field
so that you may jump directly to the correct file and code line by just
double-clicking
the error/warning. In some cases you may have to quit your text editor and
start it again for this to take effect. The examples below use the UNIX extended regular expression
syntax.
Compiler
|
Regular expression
|
File Register |
Line Register |
Column Register |
LCC-Win32
|
^.+ .*([A-Za-z]:[^:]+): ([0-9]+)
|
1
|
2
|
(none)
|
Microsoft
|
^\([^(]+\)(\([0-9]+\)) |
1
|
2
|
(none)
|
GCC
|
^\(.[^:]+\):\([0-9]+\): |
1
|
2
|
(none)
|
Others
|
^\([^(]+\)(\([0-9]+\),\([0-9]+\)) |
1
|
2
|
3
|
- Add all WinBinder source code files to the project. These files are located at the C:\WinBinder\WinBinder\Source
and C:\WinBinder\WinBinder\Source\wb folders. Source file extensions
and .C and .H. Files located at C:\WinBinder\WinBinder\Source
comprise the higher-level
layer (the PHP layer) while files located at C:\WinBinder\WinBinder\Source\wb
are the lower-level layer (called the API layer).
- Most Windows compilers add automatically to each project at least the
following standard libraries: kernel32, user32 and gdi32.
Also be sure to include (or check if the compiler adds) the following additional
Windows libraries: iehelper, psapi, uuid, shell32,
ole32, oleaut32, comctl32, comdlg32 and winmm.
- You must also add the php4ts static library to the project.
This library will be linked to the WinBinder DLL and contains the necessary
references to phpts.dll (the dynamic library that comes with PHP).
A php4ts static library for your compiler (usually with the extension .lib
or .a) may be available at the PHP
web site or at the WinBinder
web site. To build the library for your specific compiler, you will
need an export file that lists all functions in phpts.dll. You may use the
included export file php4ts.exp or build your own. To build an export
file for Lcc-win32, create php4ts.exp as an empty text file and type php4ts.dll
in the first line. Then use a tool like Dependency
Walker to obtain the list of exported functions in php4ts.dll. Paste
the function list (one per line) to php4ts.exp and add a '_' in front of
each function name. Finally, use the "build library" tool of your
compiler to build the php4ts static library. In Lcc-win32, create a console
(DOS) window and type C:\lcc\bin\buildlib.exe php4ts.exp php4ts.lib.
- Do not include an .RC (Windows resource) file in the project.
NOTE
- Repeat the process above, creating a second project for PHP 5. Be sure
to replace all existing references to PHP 4.
Building WinBinder
- Now you are ready to create the makefile and build the DLL. Be sure
to check whether the debug options are enabled or not before distributing
the file.
Additional information
- If you use TextPad, see also C:\WinBinder\tools\textpad\readme_textpad.txt for more configuration
tips.
- If you use LCC-Win32, see also C:\WinBinder\tools\Lcc-win32\readme_lccwin32.txt for additional
tips.
See also
How WinBinder works