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.

Dark GDK / Strings as dwords

Author
Message
EddieB
20
Years of Service
User Offline
Joined: 29th Sep 2004
Location: United Kingdom
Posted: 25th Aug 2006 21:12
I was just wondering, why does DBPRO and GDK use dwords for strings? I believe this is one of the main cause why they cannot get gcc working with gdk...

Any light on this?
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 25th Aug 2006 21:19
A mere oversight on the function prototypes. They are still pointer address values. I've already given reasons for not porting to GCC in another thread.

Paul.

EddieB
20
Years of Service
User Offline
Joined: 29th Sep 2004
Location: United Kingdom
Posted: 25th Aug 2006 21:46 Edited at: 25th Aug 2006 21:47
Sounds a bit messed up if you ask me
Andyhhp
18
Years of Service
User Offline
Joined: 8th Feb 2006
Location: um... here
Posted: 17th Sep 2006 21:48
What people dont realize is that Strings and DWORDS are exactly the same

A string is an array of characters in memory. As with all arrays, the variable name is a pointer to the 0th element in the array which, in 32bit code is a 4 byte number

Last time I checked, a DWORD was also a 4 byte number. This is interpreted by the DGK in exactly the same way as a 'char *' varable would be.

Hope that helps

Andrew

It's only open source 'till money is involved
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 17th Sep 2006 22:22
Right you are. DWORD is an asm term for an unsigned 32-bit generic variable. It has always been used for flat 32-bit pointers...even in ASM. Actually DWORD is a size, not even a variable type.

EddieB...it looks like you have gotten used to the terms that were created in order to mask things like DWORD. That's a bit of a shame, really...because it naturally follows, and casting is a breeze.

Strings are not built-in types in C. For one thing, they cannot be reduced to a finite size. The char array is a nice way to get around that in a legal way for the CRT.

I have not yet sussed out DBP's string use, but I assume it is more like a BSTRING. In that case, it is not like char array...at least not quite. The first location in a BSTRING is the length. Next comes the NULL terminated array of chars.
EddieB
20
Years of Service
User Offline
Joined: 29th Sep 2004
Location: United Kingdom
Posted: 18th Sep 2006 08:42
Quote: "What people dont realize is that Strings and DWORDS are exactly the same

A string is an array of characters in memory. As with all arrays, the variable name is a pointer to the 0th element in the array which, in 32bit code is a 4 byte number

Last time I checked, a DWORD was also a 4 byte number. This is interpreted by the DGK in exactly the same way as a 'char *' varable would be.

Hope that helps

Andrew"


I am aware of this. I was simply wondering why they use it.. and strings are the main problem to getting it to work with gcc compilers.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 18th Sep 2006 12:14
Strings are not the only problem with getting it to work with GCC. The runtime library function binding is also way off. If DGDK has been compiled against the Microsoft Common Runtime library, you will have a headache trying to bind your libs into a GCC exe. DGDK also links against other dependencies... so good luck!

Paul.

Argon Knight
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Gastonia, NC, USA
Posted: 19th Sep 2006 06:56
DWORD or char *.. either one would work for me, but sure would be nice if there was a consistancy and only 1 form was used.
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 19th Sep 2006 08:39
The help topic Third Party Commands (About making dlls) explains the difference in C++ type strings and DBPro type strings a little.

DWORD and string are not the same at all. They just look the same size when the "string" is really a 32-bit pointer. As I said, DWORD is a size, and String is a type.

C++ and BASIC implement strings in different manners, that is why they are difficult to use. There used to be a cast to BSTRING which worked for C++ and VB. Otherwise, find out the difference and code it in the C++ side.

I am writing a dll for DBPro now, so I am going to try to dummy up a set of serviceable conversion routines. One side is done already in the help topic.

Login to post a reply

Server time is: 2024-11-19 08:26:43
Your offset time is: 2024-11-19 08:26:43