Results 1 to 3 of 3

Thread: PHP call Dll Function?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    148

    Post 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.

  2. #2
    New Member
    Join Date
    Dec 2008
    Posts
    9

    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.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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
  •  



Click Here to Expand Forum to Full Width