Kassim Machioudi | 5 Feb 2007 13:13

Re: SWIG & PHP

Kassim Machioudi a écrit :
> All,
>
> I am new to SWIG and would like to get a simple example running, but 
> without success. I get the error below:
>
> example_wrap.obj : error LNK2019: unresolved external symbol 
> __imp__compiler_globals referenced in function _zm_startup_example
>
> while running this command:
>
> link /nologo /dll /machine:I386 -out:D:\dev\Swig\test\php_example.dll  
> .\example.obj  .\example_wrap.obj user32.lib         gdi32.lib        
>  comdlg32.lib     comctl32.lib     shell32.lib         ole32.lib         
>  oleaut32.lib      winmm.lib         advapi32.lib     php5ts.lib
>
> Any clues about how to solve this issue?
>
> Thanks,
>
> --
> Kassim
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Swig-user mailing list
> Swig-user <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
>   
Hi,

I have been able to successfully build a php DLL using SWIG, but I am 
unable to use it. When I try to load the DLL in my PHP script, a win32 
exception (access violation) is raised. Here are the steps I used to 
compile my PHP DLL.

PHP 5.2.0 binaries located at: D:\SWIG\php-5.2.0-Win32
PHP 5.2.0  code source located at: D:\SWIG\php-5.2.0

Example.cpp located at (D:\SWIG\src) contains:
#include <stdio.h>

void print_hello ()
{
    printf ("Hello world!") ;
}

Example.i (located at D:\SWIG\src) contains:
%module example
%{
extern void print_hello () ;
%}

void print_hello () ;

Command lines:

swig -c++ -php5 example.i

cl /nologo /MT /LD /W3 /EHsc /O2 /FD /c  /D "NDEBUG" /D ZEND_DEBUG=0 /D 
"WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZTS=1" /D 
HAVE_WIN32STD=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "__WIN32__"  /I 
"D:\SWIG\php-5.2.0" /I "D:\SWIG\php-5.2.0\main" /I 
"D:\SWIG\php-5.2.0\Zend" /I "D:\SWIG\php-5.2.0\TSRM"  /Fo".\\" /Fd".\\" 
D:\SWIG\src\example_wrap.c  D:\SWIG\src\example.c

link /nologo /dll /machine:I386 -out:D:\SWIG\src\php_example.dll  
.\example_wrap.obj  .\example.obj user32.lib php5ts.lib

This procedure produces php_example.dll. When I run a test script 
containing dl('php_example.dll'), I get an "Unhandled win32 exception 
which occurs in php.exe".

Does someone can help me regarding this issue?

Thanks,

--
Kassim

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane