Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now