Re: [INTERNALS-WIN] Developing PHP extensions on Windows with VC++, linking problems
[email protected] (Eugenio Tacchini)
| Newsgroups | php.internals.win |
|---|---|
| Message-ID | <[email protected]> |
Hi all, thanks for your kind replies; I tried to follow your advices but I still have problems. I tried to compile PHP on win (without my extension) following the tutorial you pointed me out http://blog.harddisk.is-a-geek.org/index.php/dev/php/php-on-windows/ and everything seems to work (I haven't tested the PHP release built however, but I didn't get error messages). I then created under /ext a folder /my_extension and put there all the files and folder produced by visual studio when I created my custom extension following the tutorial http://www.talkphp.com/vbarticles.php?do=article&articleid=49&title=creating-custom-php-extensions: - release (folder) - debug (folder) - dllmain.cpp - ReadMe.txt - my_extension.cpp - my_extension.vcproj - my_extension.vcproj.MYCOMPUTERNAME.MYNAME.user - my_extension.vcproj.MYCOMPUTERNAME.MYUSERNAME.user - stdafx.cpp - stdafx.h - targetver.h I then created a file config.w32 in the same folder, the file contains just one line: EXTENSION(my_extension, 'my_extension.cpp', false); I then builconf and configure --disable-all --enable-cli, following http://blog.harddisk.is-a-geek.org/index.php/dev/php/php-on-windows/...no errors and at the end of the process my_extension resulted in the static enabled extensions. I then execute nmake but I get this error: internal_functions.c main\internal_functions.c(43) : error C2065: 'phpext_my_extension_ptr' : undeclared identifier main\internal_functions.c(43) : error C2099: initializer is not a constant I don't have any idea about the cause... Can you help me? Thanks. Eugenio At 19.27 04/05/2009 +0200, Runar Bergeheim Olsen wrote: >Hi, >In order to build your extension following the guide you linked to you need >to create a config.w32 build file. An easy example can be found in the JSON >extension[1]. Given that you've got your extension in the ext/ folder you >can build it by issuing buildconf && ./configure --enable-your-ext && nmake. >The build system is documentd in the manual aswell[2] > >Runar > >[1] http://cvs.php.net/viewvc.cgi/php-src/ext/json/config.w32?view=markup >[2] http://no.php.net/manual/zh/internals2.buildsys.php > >2009/5/4 Eugenio Tacchini <[email protected]> > >> Hello, >> thanks for your answers; is the *recommended* way the one you posted before >> http://blog.harddisk.is-a-geek.org/index.php/dev/php/php-on-windows/ >> ? >> >> I didn't understand how to build my custom extension from the above page; I >> can write the C source file (the extension itself), I can compile a PHP >> source distribution (following the instruction you posted) but I don't how >> to links these two things: where should I put my extension C files? >> I also don't understand clearly this warning >> "warning: some extensions need libraries, header files and helper apps, i >> have NO idea how to get these working! " >> >> Can you help me? >> >> If someone also knows how to build extensions from within the IDE as Runar >> said please let me know. >> >> >> Thanks. >> >> Cheers, >> >> Eugenio >> >> >> At 10.28 30/04/2009 +0200, Pierre Joye wrote: >> >hi, >> > >> >No idea, it is not a supported or it is not the recommended way to do >> >it. It is very easy to compile php and custom extensions using the >> >current system, and the IDE can still be used for debugging/analyzing >> >:) >> > >> >Cheers, >> > >> >On Wed, Apr 29, 2009 at 9:05 PM, Runar Bergeheim Olsen >> ><[email protected]> wrote: >> >> Hi, >> >> I know Elizabeth Smith figured out how to setup a VC++ 2008 project so >> that >> >> it was possible to code and build extensions from within the IDE. As far >> as >> >> I remember it worked for both debug and release builds. I first found >> the >> >> project file in her winapi project, sadly I can't remember the SVN url >> right >> >> now. Maybe anyone here got it? >> >> >> >> Runar >> >> >> >> 2009/4/29 Pierre Joye <[email protected]> >> >> >> >>> hi, >> >>> >> >>> This tutorial is completely wrong, sorry. >> >>> >> >>> You can basically any tutorial about extending PHP and then build your >> >>> extension on Windows using the common method to compile PHP itself. A >> >>> short summary can be found here: >> >>> >> >>> http://blog.harddisk.is-a-geek.org/index.php/dev/php/php-on-windows/ >> >>> (for php itself) >> >>> >> >>> Cheers, >> >>> -- >> >>> Pierre >> >>> >> >>> On Mon, Apr 27, 2009 at 5:43 PM, Eugenio Tacchini <[email protected] >> > >> >>> wrote: >> >>> > Hi all, >> >>> > I had to create a PHP extension and I read this article: >> >>> > < >> >>> >> >http://www.talkphp.com/vbarticles.php?do=article&articleid=49&title=cr >> >eating-custom-php-extensions >> >>> >http://www.talkphp.com/vbarticles.ph...php-extensions >> >>> > Everything worked fine if I keep "Debug" as "Active solution >> >>> configuration" >> >>> > in "Build->Configuration manager"....but in this way I can only use >> the >> >>> > extension created on the machine I compiled it. >> >>> > If I choose "Release" instead of "Debug" I get a fatal error: >> >>> > dllmain.obj : fatal error LNK1179: invalid or corrupt file: duplicate >> >>> COMDAT >> >>> > '_putwchar' >> >>> > Can you help me? >> >>> > >> >>> > I'm using Visual C++ 2008 Express edition, PHP 5.2.4, Win xp home. >> >>> > >> >>> > Thanks! >> >>> > >> >>> > Cheers, >> >>> > >> >>> > Eugenio >> >>> > >> >>> > -- >> >>> > Windows Internals Mailing List (http://www.php.net/) >> >>> > To unsubscribe, visit: http://www.php.net/unsub.php >> >>> > >> >>> > >> >>> >> >>> >> >>> >> >>> -- >> >>> Pierre >> >>> >> >>> http://blog.thepimp.net | http://www.libgd.org >> >>> >> >>> -- >> >>> Windows Internals Mailing List (http://www.php.net/) >> >>> To unsubscribe, visit: http://www.php.net/unsub.php >> >>> >> >>> >> >> >> > >> > >> > >> >-- >> >Pierre >> > >> >http://blog.thepimp.net | http://www.libgd.org >> > >> >-- >> >Windows Internals Mailing List (http://www.php.net/) >> >To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> -- >> Windows Internals Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >>