calling dll function from php program
I've made a program in php where i got to call a dll function.. that dll contains some hashcode.. i call this dll's function from vb6 through this code:
Private Declare Function GetHash Lib "hashGen.dll" (ByVal tEncode As String) As Long
Private Sub g开发者_开发知识库et_Key()
MsgBox GetHash("hello world")
end sub
can anybody tell me how to call this function in PHP?
here's my dll file:
http://www.4shared.com/file/-hdichIS/hashGen.htmlthnx..
You can use SWIG to wrap it in PHP extension and then load it via dl.
I don't think this is possible out of the box.
There are dynamically loadable PHP extensions in DLL form, loadable using dl()
but I strongly assume they have interfaces and functions speficic to a PHP extension.
Possibilities:
Build a wrapper EXE that uses the DLL and call the executable
Turn your DLL into a PHP extension (See @Milan's answer for details)
Run the DLL on the local system using
rundll
or similarIntroduce your DLL's functionality as a COM Object
精彩评论