How can I call a C function from php (with argmts) ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anis0408
    New Member
    • Sep 2010
    • 5

    How can I call a C function from php (with argmts) ?

    How can I call a C function from php (with argmts)?

    In fact, I just need to call a C function which is in a library. I tried this :
    system('rundll3 2.exe library.dll,fun ction 20 ');

    I can call my function but I can't pass 20 as an argument to my C function.

    I also checked php extensions but clearly that is not what I need

    Many thanks in advance for your answers
    Last edited by Frinavale; Sep 9 '10, 02:07 PM. Reason: Added the question to the thread.
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    You said you can call your function, Does that mean like this

    "rundll32.e xe library.dll,fun ction" ?

    What error does it gives if you run it with 20 as an argument?

    Does that function really accepts an argument?

    You can check it using "dll export viewer"

    Comment

    • anis0408
      New Member
      • Sep 2010
      • 5

      #3
      The function is executed and it should display the argument I gave but instead I have a random number.
      Could you explain more about the dll export viewer please ?

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        You can use swig for this purpose. This may help you.

        Regards
        Dheeraj Joshi

        Comment

        Working...