Lexikos
Joined: 17 Oct 2006 Posts: 7295 Location: Australia
|
Posted: Mon Dec 14, 2009 9:56 am Post subject: |
|
|
I presume "VendorCmdRW.dll!" means it is in that file. I'd be surprised if that is valid C/C++. Anyway,
| Code: | int (__stdcall *VendorCmdRW.dll!GetIRCode)(unsigned char*)
|
- int - This is the default return type for DllCall, so we don't need to specify a return type.
- ( * ) - It appears to be defining a pointer to a function rather than the actual exported function. If we assume the signature is correct, we can ignore this part.
- __stdcall - This is the default calling convention for DllCall, so we can ignore it.
- unsigned char* - This part might be straightforward (see below). C/C++ char is equivalent to DllCall's Char. Since it is unsigned, we prepend U. * means it is a pointer; for DllCall we just append * or P: "UChar*" or UCharP.
Try this:
| Code: | r := DllCall("VendorCmdRW.dll\GetIRCode", UCharP, ir_code)
MsgBox % "return: " r ", output: " ir_code
|
However, occasionally in C/C++ a pointer type is used not as a pointer to a single value, but a pointer to an array of arbitrary length. UCharP only covers the former case; in the latter case, the code above may be unsafe. We would need to know the usage of the function, not just its signature. |
|