[Implemented] 64 bit variables

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
MisterDr
User
User
Posts: 41
Joined: Mon Sep 29, 2003 4:14 pm

[Implemented] 64 bit variables

Post 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
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

No need to yell, Fred answered numerous time this will be for 4.0
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

What - is this like a weekly request now?

*gets out great big hammer and waves it around for all to see*
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

You're a real Expert, Karbon.

An expert knows the big hammer solution solves all problems. :)
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

You're darn right! :-)

How can a square peg fit in a round hole? Take out big hammer, beat until satisfied.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post 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 ;-)
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post 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...
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
MisterDr
User
User
Posts: 41
Joined: Mon Sep 29, 2003 4:14 pm

I can see many smartasses in this forum

Post 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!!
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post 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.
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
MisterDr
User
User
Posts: 41
Joined: Mon Sep 29, 2003 4:14 pm

Thanx

Post 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. :)
Post Reply