?
Solved

Calling External DLLs

Posted on 2002-07-03
7
Medium Priority
?
340 Views
Last Modified: 2010-05-18
how to call an external DLL file from php and send its arguments ??
0
Comment
Question by:selim007
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 400 total points
ID: 7126919
You can add PHP extensions using the dl() command. But these create new PHP functions.

I do not know if this will allow you to add any DLL.

You would need to know the actual function name and parameters.

Say you have a function fred in a dll called FRED.DLL

int fred(Int_param,String_param);

You may be able to ...

dl("Fred.dll");
$result = fred(1,"This is cool.");

Maybe.

Never tried it.
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7128717
I tried some experiments with PHP and DLL's a while back and had lots of problems.

If you have the tools (eg. Delphi etc), you might want to wrap the DLL in a COM object, which will be much easier to use with PHP.
0
 
LVL 2

Author Comment

by:selim007
ID: 7129417
i tried creating a DLL with Visual C++ using the win32 dynamic link library but it's not working with php
0
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!

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7129423
Don't PHP extenstions have to be written a certain way as PHP has to know how to deal with the actual extension?

I don't think you can add an ordinary dll (say comctl32.dll). They have to be PHP Extension DLLs.
0
 
LVL 2

Author Comment

by:selim007
ID: 7129441
any ideas on how to compile a dll in order to make it suitable for PHP ?
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7129693
There's a whole section in the manual on writing PHP extensions.  
http://www.php.net/manual/en/phpdevel.php

I even managed to write an extension in Delphi, which involved a lot of header translations, etc, so C++ should be easy in comparison.

Depending on your purpose though you may well find that COM is a much better solution.

I have a number of COM objects that work nicely under PHP, and the great thing is that I can also use them with other languages, so the same objects are used both within PHP sources and from Delphi apps.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7129731
I couldn't find a Delphi conversion of the Zend headers.

I would have thought that Project JEDI would have one but I couldn't find it.
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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…
Suggested Courses

719 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