Problem in calling DLL functions.

Submitted by: Administrator
[I have a DLL which contains simple functions
function1 is just returning a char value
function2 returns a Long value
function3 returns a int value
function4 returns a double value
function5 returns a float value

but when I assign a 4test variable by calling all above functions or printing the returned value it creates a problem.
Problem:
1. Not able to return the correct "char" value from dll function. it gives garbage. same problem is with function returning float . working fine for the function returning int,double.DLL is loaded properly. Using "SilkTest 6.5 International", windows-xp. Dll was created in .NET framework . Also the functions are wrapped into "C" wrapper
Above all function gives correct values when call in a .NET framework.]
Used proper SilkTest DataType ie. String corresponding to C Char type But this time Agents crashes giving error *** Error: The Agent has abnormally exited when Aborted and silk test hangs on the statement calling Dll function returning char .
Please see the sample code
[+] dll "C:partnerTEST70FrameXPressVishnu1.dll"
[ ] String ReturnChar()
[ ] float ReturnFloat()
[ ] double ReturnDouble()
[ ] long ReturnLong()
[ ] int ReturnInt()
[+] testcase DllTest()
[ String str=ReturnChar()
// hangs for ever at above statement and agent crashes
[ ] Print(ReturnInt())
[ ] Print(ReturnChar())
[ ] Print(ReturnFloat())
[ ] Print(ReturnDouble())
[ ] Print(ReturnLong())
in Dll definition of ReturnChar()
Char ReturnChar()
{
Char a='h' ;
return a;
}
Submitted by: Administrator

Read Online SilkTest Job Interview Questions And Answers