
jinil.george1.5524898896348042E12 asked a question.
Calling a dll function
URGENT
Hi,
Please suggest with example to call the dll function, in InstallScript, which shall look in C++ as:
prototype:
short myDll.myFunction (short &,integer &,short &,short &);
function call:
short param1=-1,param2=0,param3=0;
int param4 = 0;
nReturn = myFunction(param1, param2, param3, param4); //all parameters are output paramters.
param2 &= 0x00FFFFFF; //after the function call, need to remove the most significant byte.
So how to implement this functionality in Installscript.:confused:
Please help.
Thanks in advance :)
include
void __stdcall myFunction(short& p1, int& p2, short& p3, short& p4)
{
p1 = 1;
p2 = 2;
p3 = 3;
p4 = 4;
}and assuming you've set up a .def file for exports and such, this InstallScript seems to work:prototype void InstallScriptCppDll.myFunction(
BYREF SHORT, BYREF INT, BYREF SHORT, BYREF SHORT);
function OnBegin( )
SHORT s1, s3, s4;
INT s2;
begin
UseDLL(SUPPORTDIR ^ "InstallScriptCppDll.dll");
myFunction(s1, s2, s3, s4);
UnUseDLL("InstallScriptCppDll.dll");
SprintfBox(INFORMATION, "DLL Results",
"s1 = %d, s2 = %d, s3 = %d, s4 = %d",
s1, s2, s3, s4);
end;
Thanks Robert. But how to remove the most significant byte? as specified in:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
How to implement this in installscript? Is there any internal function which can be called to convert to Hex, then do the AND & then revert the value back to NUMBER/INT:confused: ?
Please help.
Thanks in advance :)
You mean that I can directly call the:
param2 &= 0x00FFFFFF; // the value of param2 is ANDed with 0x00FFFFFF.
in installscript as:
p2 = p2 && FFFFFF;?
I suppose this won't work as expected. Well I looked for the Bit operator as well but I think the operands on both sides of the Bit operator should be of the same type i.e. either decimal or hexa:confused: . Please tell me if i'm wrong.
Thanks a lot :)