Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / 64 bit integers and DLL's

Author
Message
Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 24th Jan 2005 03:49
Can anyone tell me how to return a 64 bit integer from a dll into a DBpro variable?


OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Jan 2005 03:52
Should be like returning any other integer value. However, I'm not sure whether DBPro can deal with it correctly.

Test it, and if there is a problem, put in a bug report.

Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 24th Jan 2005 04:00
Well I can't get it to work. It always give me a 0 in the variable.


Vir Ex Machina
20
Years of Service
User Offline
Joined: 19th Jan 2005
Location:
Posted: 24th Jan 2005 08:24
You won't be able to..

You can cast it to a float or double and return it that way or...
return the upper and lower dwords (I do not know if DB can pass values by reference though) of the 64-bit number and figure out a way to work with them.

How are you working with 64-bit integers anyways? There are no 64-bit compilers I know of yet. You are using the quadword/INT64 in VC6? It's just a union/struct look it up in MSDN.
Vir Ex Machina
20
Years of Service
User Offline
Joined: 19th Jan 2005
Location:
Posted: 24th Jan 2005 08:52
my bad it does support LONGLONG's.

Did you use the %R% format in your function string table?
Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 25th Jan 2005 03:00
Well, I'm trying to get the value of my CPU counter, MSDN says it returns a 64bit com struct. It works with c++, but the call from DBPro always returns 0, as if the Counter is not present.

QueryPerformanceFrequency and QueryPerformanceCounter are the calls I'm trying to make from the kernel32.dll in DBPro. I'm trying to avoid the middle man .dll here.


OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 25th Jan 2005 04:09
Quote: "Did you use the %R% format in your function string table?"

Thats for plug-ins.

Quote: "It works with c++, but the call from DBPro always returns 0, as if the Counter is not present."

Lets see the code.

Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 25th Jan 2005 10:30 Edited at: 25th Jan 2005 10:30
Well, I figured it out using a pointer to a memblock. For those people who want more precision than the DBPro kernel tick, which btw may not be accurate because of the way the ticker gets called by the OS, here is a direct call to get the high precision counter your Cpu keeps. Of course you have to compute the overhead it takes to get the ticks from the cpu to be real precise, this little snippet gives you 6 more places past 1ms(The DBPro resolution).




IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Jan 2005 21:19
There is a working example of double integers in my utility plugin, along with a high-performance timer that allows you to choose your own frequency.

Just follow the link in my sig.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2025-05-29 06:13:51
Your offset time is: 2025-05-29 06:13:51