Solved

Calling External DLLs

Posted on 2002-07-03
7
333 Views
Last Modified: 2010-05-18
how to call an external DLL file from php and send its arguments ??
0
Comment
Question by:selim007
  • 3
  • 2
  • 2
7 Comments
 
LVL 40

Accepted Solution

by:
RQuadling earned 200 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 40

Expert Comment

by:RQuadling
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:RQuadling
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

19 Experts available now in Live!

Get 1:1 Help Now