[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to call c++ functions(from a dll) in PHP

Posted on 2004-10-15
5
Medium Priority
?
2,082 Views
Last Modified: 2008-03-03
How can i call my c++ dll functions in PHP? If i include it in extensions directory and put an entry in php.ini?
0
Comment
Question by:Gk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 2

Expert Comment

by:ThePCNerd
ID: 12323843
In php the functions are called just as normal php functions, you build the code for php to understand and register functions with php in your dll.

Here is the manual for creating a php extension and includes portions on how to turn your functions into php functions accessable by normal php code.

http://www.php.net/manual/en/zend.php
0
 

Accepted Solution

by:
enune earned 200 total points
ID: 12326142
Hi Gk,

Unfortunately PHP offers no way of loading external DLL's and/or exececuting code from them, as it was primarily written as a cross-platform scripting language.

However, one solution to your problem may be to write a small C/C++ application to call your DLL functions, and use PHP's many shell functions (linked below) to retrieve the data/return values from your functions.

Shell execution functions:
http://www.php.net/passthru
http://www.php.net/shell_exec
http://www.php.net/system
http://www.php.net/exec

Cheers,
Enune
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question