473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Conflicting typedef with winnt.h, windef.h and winbase.h

Hi

While compiling my application that needs "windows.h" there are some
typedef redefinition errors

redefinition at winnt.h( line 207) typedef void *HANDLE
redefinition at windef.h( line 143) typedef unsigned char BYTE
redefinition at windef.h( line 141) typedef unsigned long DWORD

#define INVALID_HANDLE_VALUE -1 redefinition at winbase.h(55) #define
INVALID_HANDLE_VALUE (HANDLE)-1

The DLL that links to my application needs the following typedefs at
the moment declared at my_include.h
As stated in User Manual --> My Definition (working and handling data
perfect but without windows.h)

HANDLE: An opaque 32-bit integer --> typedef int HANDLE;
BYTE: A 8-bit unsigned integer --> typedef unsigned int BYTE;
DWORD: A 32-bit unsigned integer --> typedef unsigned int DWORD;
LPBYTE: A 32 bit flat pointer to a variable of type BYTE --> typedef
BYTE * LPBYTE;
LPDWORD: A 32 bit flat pointer to a variable of type DWORD --> typedef
DWORD * LPDWORD;

#define INVALID_HANDLE_VALUE -1

Is it possible to make my typedefs compatible with the ones of winnt.h,

windef.h and winbase.h and still manage the data as stated in the DLL
User Manual?

Any help would be kindly appreciated
Best Regards

Nov 15 '05 #1
8 9264
Lathe_Biosas wrote:
While compiling my application that needs "windows.h" there are some
typedef redefinition errors

redefinition at winnt.h( line 207) typedef void *HANDLE
redefinition at windef.h( line 143) typedef unsigned char BYTE
redefinition at windef.h( line 141) typedef unsigned long DWORD

#define INVALID_HANDLE_VALUE -1 redefinition at winbase.h(55) #define
INVALID_HANDLE_VALUE (HANDLE)-1

Not sure what you're saying, but you're not saying it's an internal
conflict in the supplied headers, right?
The DLL that links to my application needs the following typedefs at
the moment declared at my_include.h
As stated in User Manual --> My Definition (working and handling data
perfect but without windows.h)

HANDLE: An opaque 32-bit integer --> typedef int HANDLE;
BYTE: A 8-bit unsigned integer --> typedef unsigned int BYTE;
DWORD: A 32-bit unsigned integer --> typedef unsigned int DWORD;
LPBYTE: A 32 bit flat pointer to a variable of type BYTE --> typedef
BYTE * LPBYTE;
LPDWORD: A 32 bit flat pointer to a variable of type DWORD --> typedef
DWORD * LPDWORD;

#define INVALID_HANDLE_VALUE -1
How about you put all your stuff into a common namespace by adding a common
prefix? Other than that, for explicitly sized types, use stdint.h and
uint8_t or int32_t instead of inventing you own stuff that is confusing
(unsigned int = 8bit?) or even wrong (a word is not always 16 bit).

BTW: it's a good idea to reserve ALL_UPPERCASE for macros - that way you
can immediately spot them.
Is it possible to make my typedefs compatible with the ones of winnt.h,
windef.h and winbase.h and still manage the data as stated in the DLL
User Manual?


Change the typedefs, simple as that. In that aspect, your headers are as
broken as the win32 ones, but changing yours will probably be easier.

Uli

Nov 15 '05 #2
Ulrich Eckhardt wrote:
Not sure what you're saying, but you're not saying it's an internal
conflict in the supplied headers, right?


YES
The DLL that links to my application needs the following typedefs at
the moment declared at my_include.h
As stated in User Manual --> My Definition (working and handling data
perfect but without windows.h)

HANDLE: An opaque 32-bit integer --> typedef int HANDLE;
BYTE: A 8-bit unsigned integer --> typedef unsigned int BYTE;
DWORD: A 32-bit unsigned integer --> typedef unsigned int DWORD;
LPBYTE: A 32 bit flat pointer to a variable of type BYTE --> typedef
BYTE * LPBYTE;
LPDWORD: A 32 bit flat pointer to a variable of type DWORD --> typedef
DWORD * LPDWORD;

#define INVALID_HANDLE_VALUE -1


How about you put all your stuff into a common namespace by adding a common
prefix? Other than that, for explicitly sized types, use stdint.h and
uint8_t or int32_t instead of inventing you own stuff that is confusing
(unsigned int = 8bit?) or even wrong (a word is not always 16 bit).


I didn't invented my own stuff (typedefs), what you can read on my post
is cited from the DDL Programming Functions Users Manual. (As stated in
User Manual) They define a BYTE as a 8 bit unsigned integer, why?,
unfortunatelly I don't know that.
Is it possible to make my typedefs compatible with the ones of winnt.h,
windef.h and winbase.h and still manage the data as stated in the DLL
User Manual?


Change the typedefs, simple as that. In that aspect, your headers are as
broken as the win32 ones, but changing yours will probably be easier.


As I'm a beginner with programming I thought there was an elegant
solution to make
interact the typedefs of windows.h and the typedefs of header file
provided. (i.e. Some kind of typecast)

What I did for the moment was to _invent_ a new header file
(modification of the one that was provided), removed all the
conflicting typedefs and modified the existing extern fuctions with C
data types, i.e. (int instead of HANDLE).

It compiled with out problems, I will check now the variables are
sending the right values. As for now the HANDLE handles ok.

Thank you for your answer
Kind Regards

Nov 15 '05 #3
Lathe_Biosas wrote:
Ulrich Eckhardt wrote:
Not sure what you're saying, but you're not saying it's an internal
conflict in the supplied headers, right?
YES


Most likely including a header you are not meant to include directly.
The DLL that links to my application needs the following typedefs at
the moment declared at my_include.h
As stated in User Manual --> My Definition (working and handling data
perfect but without windows.h)

HANDLE: An opaque 32-bit integer --> typedef int HANDLE;


<snip>
I didn't invented my own stuff (typedefs), what you can read on my post
is cited from the DDL Programming Functions Users Manual. (As stated in
User Manual) They define a BYTE as a 8 bit unsigned integer, why?,
unfortunatelly I don't know that.


All this is highly Windows specific, so please take it to a Windows
programming group. Here we deal with standard C, not the extension
provided by Windows, Posix, Linux etc.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #4
Hi thanks for you answer, I will go to the Windows specific group

By the way, what is the meaning of <snip> ?

Regards

Nov 15 '05 #5
>Most likely including a header you are not meant to include directly.
mmm... Maybe....

Hi thanks for you answer, I will go to the Windows specific group

By the way, what is the meaning of <snip> ?

Regards

Nov 15 '05 #6
Lathe_Biosas wrote:

<snip>
By the way, what is the meaning of <snip> ?


It is used to indicate where you have snipped some of the text from the
message you are replying to.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #7
On 1 Sep 2005 14:01:17 -0700, "Lathe_Biosas"
<la**********@hotmail.com> wrote:
Most likely including a header you are not meant to include directly.

mmm... Maybe....

Hi thanks for you answer, I will go to the Windows specific group

By the way, what is the meaning of <snip> ?

Regards


It indicates that material not relevant to the reply has been edited
out (snipped).
--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 15 '05 #8
Lathe_Biosas wrote:
Most likely including a header you are not meant to include directly.


mmm... Maybe....

Hi thanks for you answer, I will go to the Windows specific group

By the way, what is the meaning of <snip> ?

Regards

Snipping is what you do with scissors.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ton van den Heuvel | last post by:
Hi all, why does the following code not compile, and fail with: qed.cpp: In instantiation of `B<Foo*>': qed.cpp:40: instantiated from here qed.cpp:29: error: conflicting return type...
7
by: Thiru | last post by:
I am writing an application that interacts with Oracle and Teradata. In order to create the executable, I need to link various Oracle and Teradata libraries. I found out that when I link the...
4
by: Alexander Gorshenev | last post by:
I am looking for an elegant solution for the following problem: I have two projects for which I have to create a kind of bridge or translator between. For each of the projects there exist a set...
15
by: Merrill & Michele | last post by:
typedef struct { WORD versionNumber; WORD offset; } MENUITEMTEMPLATEHEADER; This is from vol 5 of unnamed platform's programmer's reference. I could make this conforming by enclosing...
0
by: ad | last post by:
How can I get application directory in winbase application?
2
by: Don Rich | last post by:
Please share with me any ideas you may have for troubleshooting and resolving the subject problem. I can give more details as necessary. (Please advise if I should post this problem to a more...
8
by: Mohammad Omer Nasir | last post by:
Hi, i made a structure in header file "commonstructs.h" is: typedef struct A { int i; A( ) {
12
by: Michael.Z | last post by:
Anyone who can help: Given a Table.h file I am writing a Table.c file. I keep getting the compile error: previous declaration of Table was here / conflicting types for I think the...
1
by: mrpetegroups | last post by:
Hi - Problem: The file below has become zero length \winnt\assembly\GAC_MSIL\system.deployment\2.0.0.0_b03f5f7f11d50a3a \system.deployment.dll Details follow ... I've been programming...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.