|
-
Dec 21st, 2008, 03:55 AM
#1
Thread Starter
Addicted Member
PHP call Dll Function?
Is there a way to use PHP and call dll function?
here is function for C:
Code:
const char *CreateCodeWithString(int level, const char *name, const char *templ, unsigned long HFF, unsigned short other1, unsigned short other2, unsigned short other3, unsigned short othe4, unsigned short otherinfo5, const char *wordstring);
DLL: Code.DLL
That function will return a String and that string is what i want to know
Thankx Much if anyone can make me a example.
-
Dec 24th, 2008, 12:41 PM
#2
New Member
Re: PHP call Dll Function?
Keep in mind this will only work if the target platform runs a windows OS.
http://nz2.php.net/manual/en/function.system.php
You could potentially do this if you made a binary .exe file to take input, do the fuddling around with the DLL that you'd like, then return the data to the console (the command line). Run it all from PHP and get whatever the app spat out into the console with that.
That should do it.
-
Dec 25th, 2008, 11:33 PM
#3
Re: PHP call Dll Function?
On Windows:
http://au2.php.net/manual/en/ref.w32api.php
On other platforms, you'll need to make a binary as described above and call it with 'system' or 'exec'. This is because the PHP interpreter does not do binary linking when it executes a script.
(Contrary to the advice given, the second method will work on non-Windows platforms.)
If you find yourself doing this often, you might want to investigate creating an extension instead, so that you can call the functions in a native PHP manner.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|