Win32api - How to return a float?

Hi guys,

I am trying to interface with a DLL I have created. I have no problems with integers and strings as the argument or return types, but I can’t figure out how to use floating point values.

This is my test function in the DLL

extern "C" __declspec (dllexport) float test()
{
	return 1.2345;
}

I have tried a few things, the last being this;

numTest = Win32API.new("test.dll", "test", "", "P")
temp = numTest.Call()
t1 = temp.unpack("f")

But ‘t1’ keeps showing [nil].

Any advice would be greatly appreciated.

Thanks in advance.

Can I buy a vowel? :stuck_out_tongue:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs