tags:

views:

47

answers:

2

swig -php example.i

This will produce 3 files example_wrap.c, php_example.h and example.php. The first file, example_wrap.c contains all of the C code needed to build a PHP extension. The second file, php_example.h contains the header information needed if you wish to statically link the extension into the php interpreter. The third file, example.php can be included by PHP scripts.

ya the three files are created, then execute the following coding.

this is used for create the example.so file.

gcc `php-config --includes` -fpic -c example_wrap.c
gcc -shared example_wrap.o -o example.so

but so many errors will displayed,

help me..

A: 

I think you're missing a step along the way, example.i should accompany example.[hc] so your compilation should go something like:

gcc -c example.c -o example.o
gcc `php-config --includes` -fpic -c example_wrap.c
gcc -shared example_wrap.o example.o -o example.so
Neel
A: 

I have exactly the same problem and the solution given here doesn't help.

Here is a sample of the errors.

C:/xampp/xampp/php/dev/include/Zend/zend_execute.h:357: error: syntax error before "char" C:/xampp/xampp/php/dev/include/Zend/zend_execute.h:358: error: syntax error before "char" C:/xampp/xampp/php/dev/include/Zend/zend_execute.h:359: error: syntax error before "char" C:/xampp/xampp/php/dev/include/Zend/zend_execute.h:360: error: syntax error before "uint"

Din