> What functionality is it that you feel is lacking from sapi/embed?  I know
> that C != C++, but C++ can certainly link against C libraries and using
> sapi/embed is pretty well dirt-simple.  Or were you planning on dumbing it
> down to the point where the C++ developer doesn't need to know what zval*
> is, let alone how to interact with script code.
Yes, I want to make it easy for someone who doesn't know anything
about how to handle core PHP/Zend code. Here is a litte sample of what
already can be done with it:

#include "php-cpp.h"

PHPCPP_FUNCTION( my_func )
{
    PHPCPP_CHECKARG( 1 );
    PHPCPP_VECTORIZE( Params );
    Params[ 0 ]++;

    PHPCPP_RETURN( Params[ 0 ] );
}

int main( )
{
    // Initialize, called once per app.
    Php :: Initialize( );

    Php :: AddFunctionEx( my_func );

    Php :: RequestStart( );
    {
        Php :: clZval A( 10 );
        Php :: clZval B( 20 );
        Php :: clZval C;

        C = A + B;
        Php :: SetGlobal( "foo", C );
        Php :: Interpret( "echo( my_func( $foo ) );" );
    }
    Php :: RequestEnd( );

    Php :: Destroy( );
}
(This code is untested, I've wrote it from memory =P)

> That depends very largely on whether or not you want it to be PHP4
> compatable.  The structure is similar enough that PHP4 classes will work in
> PHP5, but if you're willing to eschew PHP4 support, it'd be best to go with
> a clean PHP5 design....
I'm not aiming for PHP4. I even have this in my code:

#define PHPCPP_PHPVERSION ( PHP_MAJOR_VERSION * 10 + PHP_MINOR_VERSION )
#if PHPCPP_PHPVERSION < 51
    #error "Only PHP 5.1.0 and up is supported!"
#endif

> Wait.... are you planning on giving your PHP scripts direct access to your
> C++ object instances?  Thats.... daring...
Basically, yes. =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to