Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.



C++
#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

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
 
Share this answer
 
Comments
Ron Anders 6-May-13 15:58pm    
Doesn't work with a command line build
Sergey Alexandrovich Kryukov 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 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 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 6-May-13 18:01pm    
Yeah I'll try harder.
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
 
Share this answer
 
Comments
Ron Anders 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900