Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ setup
Hi,
 
I have a com dll where the source code is the same for both it's 32 bit build and it's 64 bit build.
 
I found an instance where it is necessary to deploy both the x86 and x64 versions on customer boxes but need the GUIDS of the x86 and x64 versions to be obviously different.
 
Right now I am attempting at build time to "adjust" the GUIDs on the fly, but this is not working.
 
I am running a command line build script to rebuild and package it all.
 
Here is what I am doing that does not work (Always evaluates to WIN32). Perhaps because I am
building it using a WIN32 box.
 
What I need is a preproccesor directive that can detect that I am BUILDING an x64 dll
and choose the GUID I have "assigned" to the x64 dll. Or that I am BUIDLING an x86 dll
and choose that GUID.
 
I have read about conditional compilation symbols but I am running VS2008 and can't find that in there to even test it.
 

 
#ifdef WIN64
const GUID CLSID_BCRSlave = { 0x617a3262, 0x19a3, 0x44b4, { 0xae, 0x38, 0xd2, 0x51, 0xe2, 0x63, 0x02, 0x64 } };
#endif
#ifdef WIN32
const GUID CLSID_BCRSlave = { 0x617a3262, 0x19a3, 0x44b4, { 0xae, 0x38, 0xd2, 0x51, 0xe2, 0x63, 0x02, 0x32 } };
#endif
 
Thanks a bunch to anyone that can help.
Beta tester awaits.
 
:Ron
Posted 6-May-13 7:35am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you generate GUID during run time, the problem is not clear, as not only the values will be different for different instruction-set architectures, but they will be different even for different instanced of a process.
 
If you want to generate GUID just one and have the data at compile time, you can use predefined macros _M_IX86, _M_IA64 and _M_X64:
http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.110%29.aspx[^].
 
‐SA
  Permalink  
Comments
Ron Anders at 6-May-13 15:58pm
   
Doesn't work with a command line build
Sergey Alexandrovich Kryukov at 6-May-13 16:22pm
   
What does not work? What do you mean by "does not work"? How is it related to command line build? All builds should ultimately be command-line, so what?
—SA
Ron Anders at 6-May-13 16:30pm
   
I used those macros in ifdef / endif checks and if I am in the IDE on a 32bit machine than the
64 bit block is grayed out as expected but when I build the x64 and the x86 versions with the command line script all dlls have the x64's GUIDs and so there is a conflict still.
 
I have resigned myself to having a 64 bit version of the dll generator code and a 32 bit version in the different configurations with only the GUID const definition as a difference
I would like to have conditional compilation with regard to the const GUID declaration, , but I can't pull it off - yet.....
Sergey Alexandrovich Kryukov at 6-May-13 16:35pm
   
You did not explain why would you need those GUIDs at all and why should they be different. I answered to your original question anyway.
—SA
Ron Anders at 6-May-13 18:01pm
   
Yeah I'll try harder.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this -
#ifdef _WIN64
 
const GUID CLSID_BCRSlave = { 0x617a3262, 0x19a3, 0x44b4, { 0xae, 0x38, 0xd2, 0x51, 0xe2, 0x63, 0x02, 0x64 } };
 
#else
 
const GUID CLSID_BCRSlave = { 0x617a3262, 0x19a3, 0x44b4, { 0xae, 0x38, 0xd2, 0x51, 0xe2, 0x63, 0x02, 0x32 } };
 
#endif
  Permalink  
Comments
Ron Anders at 6-May-13 23:35pm
   
Yup!
 
My problem was that _Win32 is always defined even in win64 - I did not know that, but I do now
Thank _Superman!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 329
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 185
4 PIEBALDconsult 149
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 6 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100