Re: [PHP] PHP with C++

2008-06-09 Thread Wolf
 R B [EMAIL PROTECTED] wrote: 
 Hi,
 I have a C++ script containing the function hello(x, y, z)
 
 I want to access this C++ function from PHP, and output with PHP the return
 information.
 
 How can i do this?

Where's your failing code?

STFW: 
http://www.google.com/search?q=PHP%3A+C%2B%2Bie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:unofficialclient=firefox-a

When you have code that is failing, post it here and we'll see if we can help 
you get the bugs out.

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++

2008-06-09 Thread Stut

On 9 Jun 2008, at 14:11, R B wrote:

I have a C++ script containing the function hello(x, y, z)

I want to access this C++ function from PHP, and output with PHP the  
return

information.

How can i do this?


1) Buy this book...

http://www.amazon.com/dp/067232704X?tag=libssh2projec-20camp=14573creative=327641linkCode=as1creativeASIN=067232704Xadid=0RDRTQB9KQ7ATE0MAY5R;

2) Read it carefully.

3) Try writing an extension to wrap your function.

4) Post questions here if you have problems but be sure you show that  
you've done 1-3 or we'll ignore you.


Extensions aren't rocket science, but there are many gotcha's and that  
book helped me a lot when I was starting out. Don't feel like shelling  
out for the book? Check out the many extensions included in the PHP  
source, but be aware that it's not overly simple.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++[Zend Engine?]

2008-06-09 Thread Павел aka [R-K]
You wrote:

 4) Post questions here if you have problems but be sure you show that
 you've done 1-3 or we'll ignore you.
I read this book and some else,but nothing book helped me in writing Zend - 
Extension...
I'd like to wrote some similar but simplier them Zend Encoder... If you can, 
help me please.

PS.Sorry for my English.

-- 
===
С уважением, Манылов Павел aka [R-k]
icq: 949-388-0
mailto:[EMAIL PROTECTED]
===
А ещё говорят так:
A kid'll eat the middle of an Oreo, eventually.
[fortune]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++[Zend Engine?]

2008-06-09 Thread Павел aka [R-K]
You wrote:

 4) Post questions here if you have problems but be sure you show that
 you've done 1-3 or we'll ignore you.
I read this book and some else,but nothing book helped me in writing Zend - 
Extension...
I'd like to wrote some similar but simplier them Zend Encoder... If you can, 
help me please.

PS.Sorry for my English.

-- 
===
С уважением, Манылов Павел aka [R-k]
icq: 949-388-0
mailto:[EMAIL PROTECTED]
===
А ещё говорят так:
A kid'll eat the middle of an Oreo, eventually.
[fortune]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++[Zend Engine?]

2008-06-09 Thread Pavel
You wrote:

 4) Post questions here if you have problems but be sure you show that
 you've done 1-3 or we'll ignore you.
I read this book and some else,but nothing book helped me in writing Zend - 
Extension...
I'd like to wrote some similar but simplier them Zend Encoder... If you can, 
help me please.

PS.Sorry for my English.

-- 
===
С уважением, Манылов Павел aka [R-k]
icq: 949-388-0
mailto:[EMAIL PROTECTED]
===
А ещё говорят так:
PS Документация zsh - просто нечеловеческая.
-- vyt in community@
[fortune]


Re: [PHP] PHP with C++[Zend Engine?]

2008-06-09 Thread Павел aka [R-K]
You wrote:

 4) Post questions here if you have problems but be sure you show that
 you've done 1-3 or we'll ignore you.
I read this book and some else,but nothing book helped me in writing Zend - 
Extension...
I'd like to wrote some similar but simplier them Zend Encoder... If you can, 
help me please.

PS.Sorry for my English.

-- 
===
С уважением, Манылов Павел aka [R-k]
icq: 949-388-0
mailto:[EMAIL PROTECTED]
===
А ещё говорят так:
A kid'll eat the middle of an Oreo, eventually.
[fortune]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++

2008-06-09 Thread Daniel Brown
On Mon, Jun 9, 2008 at 9:11 AM, R B [EMAIL PROTECTED] wrote:
 Hi,
 I have a C++ script containing the function hello(x, y, z)

 I want to access this C++ function from PHP, and output with PHP the return
 information.

 How can i do this?

The cheating, quickest, easiest way, would be to write the
function into a portable C++ script, compile it to binary form, and
pass `x`, `y`, and `z` as argv[]'s via PHP's exec() function, like so:

?php
$ret = null;
// In the exec() call below, note the quotes around special characters
and spaces.
exec('./cpp-binary argument1 argument2 argument three?',$ret,$err);
if(count($ret)  1) {
foreach($ret as $r) {
echo $r.br /\n;
}
} elseif(count($ret) == 1) {
echo $ret[0].br /\n;
} else {
echo Nothing returned by exec()!  Error Level: .$err.br /\n;
}
?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with C++

2008-06-09 Thread Pavel
You wrote:

 4) Post questions here if you have problems but be sure you show that
 you've done 1-3 or we'll ignore you.
I read this book and some else,but nothing book helped me in writing Zend - 
Extension...
I'd like to wrote some similar but simplier them Zend Encoder... If you can, 
help me please.

PS.Sorry for my English.

-- 
===
С уважением, Манылов Павел aka [R-k]
icq: 949-388-0
mailto:[EMAIL PROTECTED]
===
А ещё говорят так:
PS Документация zsh - просто нечеловеческая.
-- vyt in community@
[fortune]


Re: [PHP] PHP to C interface?

2005-02-21 Thread N Deepak
On Fri, Feb 18, 2005 at 09:20:02AM -0800, Richard Lynch wrote:
Is there a way to invoke C functions in a library (.so) from PHP?
Like Xs in Perl?
 
 By definition, then, all you have to do is learn how to write a PHP
 extension, which Rasmus tells you how to do in a one-hour lecture at any
 PHP/Linux/Apache/OpenSource conference you care to name :-)
 
 But rather than spend hundreds to attend a conference, you can access his
 talk on this topic at:
 
 http://talks.php.net
 
Thanks for pointing out.  When I look up the 'Extensions' category, I get
mostly presentations on HTML Tidy under PHP?

http://talks.php.net/index.php/Extensions?PHPSESSID=b8b25bec4cebea1f748893292ab077e5

Thanks,
Deepak

-- 
N Deepak || http://www.ndeepak.info/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP to C interface?

2005-02-18 Thread Zareef Ahmed
Hi,

 Please Visit

http://pear.php.net/package/Inline_C

may be usefull

zareef ahmed 



On Fri, 18 Feb 2005 01:19:19 -0800, N Deepak [EMAIL PROTECTED] wrote:
 Hi,
 
   Is there a way to invoke C functions in a library (.so) from PHP?
   Like Xs in Perl?
 
 Thanks,
 Deepak
 
 --
 N Deepak || http://www.ndeepak.info/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP to C interface?

2005-02-18 Thread N Deepak
On Fri, Feb 18, 2005 at 02:56:05PM +0530, Zareef Ahmed wrote:
 Hi,
 
  Please Visit
 
 http://pear.php.net/package/Inline_C
 
Thanks very much.  Have you tried using it?  How mature is it?  I found
no documentation or installation guide.

Best regards,
Deepak

 On Fri, 18 Feb 2005 01:19:19 -0800, N Deepak [EMAIL PROTECTED] wrote:
  Hi,
  
Is there a way to invoke C functions in a library (.so) from PHP?
Like Xs in Perl?
  
  Thanks,
  Deepak
  

-- 
N Deepak || http://www.ndeepak.info/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP to C interface?

2005-02-18 Thread Richard Lynch
N Deepak wrote:
   Is there a way to invoke C functions in a library (.so) from PHP?
   Like Xs in Perl?

Yes.

EVERYTHING in PHP, except for the core syntax of if/else/while can be
loaded this way.

Many times, it's compiled in static, but you can make most of the modules
be shared.

By definition, then, all you have to do is learn how to write a PHP
extension, which Rasmus tells you how to do in a one-hour lecture at any
PHP/Linux/Apache/OpenSource conference you care to name :-)

But rather than spend hundreds to attend a conference, you can access his
talk on this topic at:

http://talks.php.net


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP support C++?

2004-03-08 Thread Evan Nemerson
On Monday 08 March 2004 07:03 am, Kenneth wrote:
 Hi all,

 Does PHP support C++ language?
 If yes, how can it be converted?

you can write an extensions, which is actually rather easy to do. There's an 
article at http://bugs.tutorbuddy.com/phpcpp/phpcpp/ that claims to tell you 
how to use c++ (rather than c), but I can't vouch it- never tried it.

 The case is, I've use C++ to make a function (to get data from file and
 convert it from char type to int type), how can i import the
 function/variables and use it in PHP?

Sounds like a really simple function. Why not just rewrite in in PHP?

 Thanks,
 Kenneth

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP AND C

2002-10-08 Thread Marco Tabini

Passing that many parameters shouldn't be a problem, I think...argv/argc
parsing in the standard C library is pretty fast.

On Tue, 2002-10-08 at 06:04, karthikeyan wrote:
 Hi,
 
   I want to pass some 10 to 15 parameters as input to an C Program.  Does passing it 
as command line argument through PHP using backquotes or system function is an 
effective way to solve this issue or there are some other alternative which does this 
without affecting the performance.
 
   Looking forward to you response.
 
 karthikeyan.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php