Log in

View Full Version : Returning float to eVB from DLL


dangerwit
02-19-2003, 05:44 PM
I'm really having a brain meltdown folks. I have a DLL in eVC++ that should be returning a floating point number.

For instance, I imagined it like this:

SILLY_API float GimmeAFloat(void)
{
float floater = 1.234;

return floater;
}

My question is how can I get this number back to eVB intact? I know I could work around it with strings or multiplying/dividing by a factor of 10, but I'd prefer the "proper" way.

Can anyone help me out with this?

*Phil

PPCdev
02-19-2003, 07:19 PM
Can you give some sample VB (Ugg!) code of how your calling the DLL? I know the obvious is covered, but in your VB app, are you assigning the returned value to a VB float variable?

Andrew

VanHlebar
02-20-2003, 09:44 PM
I'm really having a brain meltdown folks. I have a DLL in eVC++ that should be returning a floating point number.

For instance, I imagined it like this:

SILLY_API float GimmeAFloat(void)
{
float floater = 1.234;

return floater;
}

My question is how can I get this number back to eVB intact? I know I could work around it with strings or multiplying/dividing by a factor of 10, but I'd prefer the "proper" way.

Can anyone help me out with this?

*Phil

I could be wrong, but I thought that all eVB data types were VARIANTs. I don't believe that it makes a difference what you put as the data type. Unless they changed this from the PPC2000 to PPC2002 sdks. I am not really sure how that would impact the return value you are returning from your dll though.

-Eric

dangerwit
02-24-2003, 05:23 PM
Can you give some sample VB (Ugg!) code of how your calling the DLL? I know the obvious is covered, but in your VB app, are you assigning the returned value to a VB float variable?

Andrew

Hehehe. :)

I know that eVB uses variants, I was just concerned that eVB wouldn't know what to do with a float as opposed to a long/int ...

Incidentally, assuming this works (which I'll check), how would eVB (or its runtime, rather) differentiate 32-bit int from a 32-bit float, for example?

*Phil