-
April 10th, 2013, 12:09 AM
#1
Conditional compilation issue.
Hi,
I want to do conditional compilation based on whether it is windows 7 or windows 8. Here is the code below.
#if (_WIN32_WINNT >= 0x0602) //Condition to check whether it windows 7 or 8 .Based on this we can load msxml 3 or 6.
#import <msxml6.dll>
#else
#import <msxml3.dll>
#endif
Im building the above code in windows 8 machine.
Issue here is _WIN32_WINNT should have a value 0x0602, it means it is running in windows 8 machine.Instead it has a value 0x0601 (Means it is taking windows version as windows 7 defined in sdkddkver.h).Im not sure after installing windows 8 sdk im not able to see any include or lib files in the path below C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A . but i can see all include and lib files of sdk version v7.0A available although i did not installed it.
-
April 10th, 2013, 01:25 AM
#2
Re: Conditional compilation issue.
Did you try to add
Code:
#define _WIN32_WINNT 0x0602
into atdafx.h (before all the #includes?)
Victor Nijegorodov
-
April 10th, 2013, 01:52 AM
#3
Re: Conditional compilation issue.
thanks, this link http://blogs.msdn.com/b/vcblog/archi.../10287354.aspx helped me to resolve the issue ..
procedure followed to resolve the issue.
1)install windows 8 sdk.
2)set the path of windows 8 sdk.
But facing new issue. when i try to import msxml3.dll it is not generating .tlh and .tlb file in outpt directory
-
April 10th, 2013, 11:14 AM
#4
Re: Conditional compilation issue.
Well, importing this or that COM type library, which is what importing dll is really about, has nothing to do with Windows version the compilation occurs in, as well as Platform SDK version.
These are interfaces that msxml3.dll has impelented compared to msxml6.dll:
Code:
struct __declspec(uuid("65725580-9b5d-11d0-9bfe-00c04fc99c8e"))
/* dual interface */ IXMLElementCollection;
struct __declspec(uuid("f52e2b61-18a1-11d1-b105-00805f49916b"))
/* dual interface */ IXMLDocument;
struct __declspec(uuid("3f7f31ac-e15f-11d0-9c25-00c04fc99c8e"))
/* dual interface */ IXMLElement;
struct __declspec(uuid("2b8de2fe-8d2d-11d1-b2fc-00c04fd915a9"))
/* interface */ IXMLDocument2;
struct __declspec(uuid("2b8de2ff-8d2d-11d1-b2fc-00c04fd915a9"))
/* dual interface */ IXMLElement2;
struct __declspec(uuid("d4d4a0fc-3b73-11d1-b2b4-00c04fb92596"))
/* dual interface */ IXMLAttribute;
struct __declspec(uuid("948c5ad3-c58d-11d0-9c0b-00c04fc99c8e"))
/* interface */ IXMLError;
struct _xml_error;
enum tagXMLEMEM_TYPE;
In case your code does mot make any use of these, it must be indifferent to what exact dll you import on compilation phase.
Best regards,
Igor
-
April 11th, 2013, 01:32 AM
#5
Re: Conditional compilation issue.
As a final resort you may extract type library from any of the dlls and import the one, directly and explicitly, on any platform where you compile.
Best regards,
Igor
-
April 11th, 2013, 11:00 AM
#6
Re: Conditional compilation issue.
you don't need to do this.
you can use msxml3 on windows 8
note that what you are doing here is create an exe that is conditional on the _WIN32_WINNT define.
This does not in any way or form make an exe that will run differently depending on what OS the exe is running on.
With 2 separate compiles and 2 separate exe's, you can make an exe that is "meant for win7" and another that is "meant for Win8" but unless you have actual provisions for it, either exe will run on either OS, in so far as the used dll's and imported functions are present. If they aren't you will get a rather cryptic message stating that a certain function from a certain (system) dll cannot be found.
There is also no relation to the build machine. you can build windows 8 binaries on an older windows machine and vice verse in so far as you have installed the platform SDK's, running/debugging the exe is another matter of course.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|