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 / 2 byte (short) integer?

Author
Message
djlaptop
21
Years of Service
User Offline
Joined: 21st Sep 2002
Location:
Posted: 25th Sep 2002 21:03
Hi all,

I want to use a DLL that takes a 2 byte integer (short) as a parameter. I noticed that the standard integer in DB is 4 bytes. Is there an undocumented short type?

Thanks!
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 25th Sep 2002 23:07
Isn't WORD 2 bytes ?

Yes, I really am THAT good...
NTekk
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 26th Sep 2002 00:09
I always thought it was
Byte 8 bits
Word 16 bits
Dword 32 bits
Richard Davey
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 26th Sep 2002 03:59
A Word is indeed 16-bits (2 Bytes) which gives a range from 0 to 65535. An Integer is usually a Word sized variable but this varies from computer to computer and from programming language to language. It's not consistent. I will check with Lee tomorrow but I'm sure DB treats an Integer as a dWord.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 26th Sep 2002 05:54
Been fiddling with C -> DB values for the past few days for something i'm working on.
Use a dword as it can handle negative values, all the other types can't ... however if you are using unassigned values then just use compound versions of DBs. I've made a post somewhere with all of thier values somewhere.
However when dealing with a DLL you don't need to specify the value - simply output it as a float and interger it at the other end... if someone has it please upload the DLL creation demo from 1.13 update to show how this is done, cause right now I have niether C++ nor DB installed to give an example
You can determine the Data type you use within DB once you've processed it across, remember with a DLL you can send & recieve data values so through a couple of tests you can find out exactly what the values are.

"For the Greater Good"...
Kyi'Aun (Jedi Master) Rai'Ka

Login to post a reply

Server time is: 2024-03-29 15:32:36
Your offset time is: 2024-03-29 15:32:36