Solved

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

717 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