I am trying to create PHP on Windows along with the popular C library for processing Excel, LibXL . This library has a built-in PHP extension called php_excel . I am trying to build the latter as a shared DLL on Windows, rather than statically compiling it in PHP for distribution.
My starting point for compiling is PHP buidling for Windows wiki entries , and I use Visual Studio 2008 and the Windows SDK 6.1 as recommended, for further guidance in this explanation my reference directory c:\php-sdk\php53dev\vc9\x86\. PHP snapshot links are shown as a folder php5.3-x, where x is the date-time of the snapshot assembly.
After extracting the snapshot of PHP, I add bin\libxl.dll, include_c\*and lib\libxl.libto the corresponding folders in deps.
Then I extract the php_excel's extension php5.3-x\ext\excel-0.9.1.
Run buildconfand configure --helpshows that the extension is displayed. Then I run:
configure --disable-all --enable-cli --with-excel=shared --disable-zts --disable-isapi --disable-nsapi
nmake
To create a VC9 non-thread safe DLL assembly.
In nmakeI encounter syntax errors for each header file in LibXL:
c:\php-sdk\php53dev\vc9\x86\deps\include\enum.h(4) : error C2061: syntax error: identifier 'libxl'
c:\php-sdk\php53dev\vc9\x86\deps\include\enum.h(4) : error C2059: syntax error: ';'
...
and syntax errors in excel.c source for php_excel:
ext\excel-0.9.1\excel.c(33) : error C2146: syntax error : missing ')' before identifier 'f'
ext\excel-0.9.1\excel.c(33) : error C2061: syntax error : identifier 'f'
ext\excel-0.9.1\excel.c(33) : error C2059: syntax error : ';'
ext\excel-0.9.1\excel.c(33) : error C2059: syntax error : ')'
...
Here, for example, are these two sections from the corresponding files:
enum.h
#ifndef ENUM_CPP_H
#define ENUM_CPP_H
namespace libxl { # line 4
...
}
excel.c
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "libxl.h"
#include <stdlib.h>
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/date/php_date.h"
#include "php_excel.h"
#include "zend_exceptions.h"
static long xlFormatBorder(FormatHandle f) # line 33
{
return 1;
}
I donβt see syntax errors, but guess that I am missing an obvious step somewhere?