Solved

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

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

810 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