creating and calling a shared object from php

From: Date: Wed, 08 Dec 1999 01:02:14 +0000
Subject: creating and calling a shared object from php
Groups: php.dev 
Request: Send a blank email to php-dev+get-13504@lists.php.net to get a copy of this message
I'd like to create a simple shared object and call it from php. Would I use dl() to do this? Could anyone create a very small example, for instance a shared object with a function that adds two numbers together and returns the result, and show me how to load it using dl or some other php method? I tried to create a test shared object in C with the following code. extern C { int addition(int a, int b); } int addition(int a, int b) { return (a + b); } I compiled the code using gcc with the appropriate directives. I tried to call the shared object as follows <?php dl("sh.so"); $var1=3; $var2=4; $answer=addition($var1, $var2); ?> I'd really appreciate any help. Thanks, Tait

« previous php.dev (#13504) next »