Hello, could you please me help about that ?
In fact, I just need to call a C function which is in a library. I tried this :
system('rundll32.exe library.dll,function 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
Call C function from Php
Started by anis0408, Sep 09 2010 12:23 AM
2 replies to this topic
#1
Posted 09 September 2010 - 12:23 AM
|
|
|
#2
Posted 09 September 2010 - 10:30 PM
Your question does not relate to PHP at all,
Could you explain better the problem?
anis0408 said:
but I can't pass 20 as an argument to my C function.
Could you explain better the problem?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 10 September 2010 - 01:19 AM
The functions called from rundll32 must be explicitly implemented to be called from it. They must use stdcall convention and the following signature:
The RunDll32 utility is not designed to call arbitrary functions. You can read more about it here.
void CALLBACK Function(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);The important part is the "lpszCmdLine" argument. It receives the arguments passed to rundll32 (all you put after the dll and function name) as a text string that the dll must parse before using them. In your case I supose you have a function like this:
void CALLBACK Function(UINT value);In this case you should write an intermediate function with the first signature that parses the lpszCmdLine argument and converts it to an integer and then calls the second function with the resulting value.
The RunDll32 utility is not designed to call arbitrary functions. You can read more about it here.


Sign In
Create Account

Back to top









