Returning float from plugin functions? (SOLVED)

Started by Besh, Thu 15/12/2005 16:43:31

Previous topic - Next topic

Besh

I cannot return a float variable from my plugin functions!!!

managed struct MyStruct {
   import static MyStruct* Create(...);
   import int aaa(...);
   import float bbb(...);
}

when I call, from the script, the function aaa(...) it's all OK but when I call the function bbb(...) the return value is always 0 or NULL.

any suggestion???
"Spread our codes to the stars,
You can rescue us all"
- Muse

SSH

Maybe they're actually doubles?
12


Besh

OK!! thank you very much!!!

the soulution is:

#define FLOAT_RETURN_TYPE long
#define RETURN_FLOAT(x) return *((long*)&x)

FLOAT_RETURN_TYPE bbb (...) {
  float fval;
  .....
  .....
  RETURN_FLOAT(fval);
}
"Spread our codes to the stars,
You can rescue us all"
- Muse

SMF spam blocked by CleanTalk