Page 1 of 1

[Implemented] 64 bit variables

Posted: Tue Dec 09, 2003 9:54 pm
by MisterDr
Here is the problem:

I have a dll which return double number when I call procedure, and the catch is that just half of number is received (naturally because of lack of support in 64 bit handling). :?:

I think that is the biggest problem, and many and many dll-s are using 64 bit variables, that is really wery hard to code with workaround libraries because of code messing.
:evil:

Please if anybody have a solution?? :D
Or Fred 8O

Posted: Tue Dec 09, 2003 10:07 pm
by Berikco
No need to yell, Fred answered numerous time this will be for 4.0

Posted: Tue Dec 09, 2003 10:09 pm
by freak
There is no need to write the titel in capital letters only. We can very well
read lower case letters as well :wink:

Just search around the forums... there was a userlib for 64bit variables
somewhere.

Timo

Posted: Tue Dec 09, 2003 10:43 pm
by Karbon
What - is this like a weekly request now?

*gets out great big hammer and waves it around for all to see*

Posted: Tue Dec 09, 2003 11:00 pm
by Proteus
You're a real Expert, Karbon.

An expert knows the big hammer solution solves all problems. :)

Posted: Tue Dec 09, 2003 11:24 pm
by Karbon
You're darn right! :-)

How can a square peg fit in a round hole? Take out big hammer, beat until satisfied.

Posted: Wed Dec 10, 2003 2:37 pm
by freedimension
Karbon wrote:How can a square peg fit in a round hole? Take out big hammer, beat until satisfied.
If the peg is small enough, where's the problem? It's all a matter of organization ;-)

Posted: Wed Dec 10, 2003 4:31 pm
by Proteus
freedimension wrote:
Karbon wrote:How can a square peg fit in a round hole? Take out big hammer, beat until satisfied.
If the peg is small enough, where's the problem? It's all a matter of organization ;-)
I'm too chaotic to organize. I like the hammer method a lot more...

I can see many smartasses in this forum

Posted: Wed Dec 10, 2003 10:35 pm
by MisterDr
Like all "experts" it seems that you don't understand what was I talking about.

If you are so smart you can try to get double value from function which returns double.

AND when you tryed, AND when you stuck on this you can then understand what was I talknig about.

And meanwhile you con go out and play with your hammer in the sand.

KID!!

Posted: Thu Dec 11, 2003 8:11 am
by Danilo
Try this.

Code: Select all

Structure DOUBLE
  high.l
  low.l
EndStructure

Procedure Your_Function_That_Returns_Double()
  !FLDPI
EndProcedure

Procedure.f CatchDoubleReturn(*x.DOUBLE)
  !MOV  dword EAX,[ESP]
  !FST  qword [EAX]
  ;ProcedureReturn
EndProcedure

Procedure.f Double2Float(*x.DOUBLE)
  !MOV  dword EAX,[ESP]
  !FLD  qword [EAX]
  ;ProcedureReturn
EndProcedure

; Call your function
CallFunctionFast(@Your_Function_That_Returns_Double()) ; call DLL function
Debug CatchDoubleReturn(my.DOUBLE)

; now our double is in 'my'
; PB cant handle doubles directly, so
; lets convert it to float
Debug Double2Float(my)
Doubles are returned in ST(0), so CallFunctionF() and CallFunctionFastF()
would automatically convert it to float - if Fred adds this 1 day.

You should be careful, maybe your DLL returns a pointer to double.
In this case the above doesnt work and you have to do:
*x.DOUBLE = CallFunction....

To work with the DOUBLE variables in PureBasic after you got it
from the DLL, take a look at the F64 library from freedimension.

Thanx

Posted: Thu Dec 11, 2003 1:48 pm
by MisterDr
:D :D

I already downloaded F64 and widely I use it.

And misspointing catch for me is st(0), that's was I experimeted with eax, ebx, ecx, edx and naturally nothing was resulted.

That's was I called good help. :)