On 1/5/07, Simon Laws <[EMAIL PROTECTED]> wrote:

I'm trying to compile up the php extension again. This has worked
previously with Visual C++ Express but I'm getting the following

Deleting intermediate and output files for project 'tuscany_sca_php',
configuration 'Debug|Win32'
Compiling...
PHPImplementation.cpp
PHPServiceBinding.cpp
c:\simon\projects\eclipse3.2\cpp\sca\deploy\include\tuscany\sca\core\operation.h(171)
: warning C4267: 'return' : conversion from 'size_t' to 'unsigned int',
possible loss of data
PHPExtension.cpp
c:\simon\projects\eclipse3.2\cpp\sca\deploy\include\tuscany\sca\core\operation.h(171)
: warning C4267: 'return' : conversion from 'size_t' to 'unsigned int',
possible loss of data
PHPImplementationExtension.cpp
c:\simon\projects\eclipse3.2\cpp\sca\deploy\include\tuscany\sca\core\operation.h(171)
: warning C4267: 'return' : conversion from 'size_t' to 'unsigned int',
possible loss of data
PHPServiceWrapper.cpp
c:\simon\projects\tuscany\php\php-5.2.0\zend\zend_execute.h(143) : warning
C4311: 'type cast' : pointer truncation from 'void *' to 'ulong'
c:\simon\projects\tuscany\php\php- 5.2.0\zend\zend_execute.h(157) :
warning C4311: 'type cast' : pointer truncation from 'void *' to 'ulong'
c:\simon\apps\vcexpress2005\vc\include\xutility(191) : warning C4273:
'std::_Container_base::_Orphan_all' : inconsistent dll linkage
        c:\simon\apps\vcexpress2005\vc\include\xutility(109) : see
previous definition of '_Orphan_all'
c:\simon\apps\vcexpress2005\vc\include\xutility(203) : warning C4273:
'std::_Container_base::_Swap_all' : inconsistent dll linkage
        c:\simon\apps\vcexpress2005\vc\include\xutility(110) : see
previous definition of '_Swap_all'
c:\simon\apps\vcexpress2005\vc\include\ostream(964) : error C2491:
'std::endl' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\ostream(973) : error C2491:
'std::endl' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\ostream(982) : error C2491:
'std::ends' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\ostream(990) : error C2491:
'std::ends' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\ostream(998) : error C2491:
'std::flush' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\ostream(1006) : error C2491:
'std::flush' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\istream(1061) : error C2491:
'std::ws' : definition of dllimport function not allowed
c:\simon\apps\vcexpress2005\vc\include\istream(1096) : error C2491:
'std::ws' : definition of dllimport function not allowed
c:\simon\projects\eclipse3.2\cpp\sca\deploy\include\tuscany\sca\core\operation.h(171)
: warning C4267: 'return' : conversion from 'size_t' to 'unsigned int',
possible loss of data
Generating Code...

Ignoring the warning for a moment anyone see C2491 in any of the other
projects. it kind of rings a bell but I can't dredge it out on my mind. I
have previously successfully compiled this extension with the same versions
of VC++ and PHP as I have now. Has something changed in the solution file
that I'm inheriting from in my project but that I'm not spotting?

Regards

Simon


Well I got past this but I'm at a loss as to why it happens. In ostream in
the standard library that are a number of inline functions defined, for
example,

_CRTIMP2_PURE inline basic_ostream<char, char_traits<char> >&
   __CLRCALL_OR_CDECL endl(basic_ostream<char, char_traits<char> >& _Ostr)
   {    // insert newline and flush byte stream
   _Ostr.put('\n');
   _Ostr.flush();
   return (_Ostr);
   }

_CRTIMP2_PURE resolves to _CTRIMP2 which in turn resolves to

#ifndef _CRTIMP2
#if defined(_DLL) && !defined(_STATIC_CPPLIB)
#define _CRTIMP2 __declspec(dllimport)
#else   /* ndef _DLL && !STATIC_CPPLIB */
#define _CRTIMP2
#endif  /* _DLL && !STATIC_CPPLIB */
#endif  /* _CRTIMP2 */

So under some circumstances it would appear that these inline functions get
the calling convention __declspec(dllimport) which causes the compiler to
complain with a C2491. This is in the std library and has nothing to do with
me so I have no idea why this is causing me a problem now when it didn't
before Christmas. I can only think that something strange has happend with
the project or solution #defines. Although PHP must be adding to the problem
also as none of the other projects seem to suffer. Anyhow I got round the
problem for now by using

#include <iostream>

before

#include <php_embed.h>

Hence preventing PHP form including iostream directly. The build is now
happy. Now on to testing it.

Regards

Simon

Reply via email to