Solved

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

Posted on 2004-10-15
5
1,812 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
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 …

749 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