views:

234

answers:

2

I am creating a wrapper around a native lib, which comes in both 32 & 64 bit flavors. I have a fairly complex C++/CLR project that includes a number of header files from the native libs. I got it to work fine on x32, but now I'm not sure how to provide an alternative x64 build.

Can someone outline the steps to create such project?

  • Various defines depend on _WIN32 / _WIN64, so must be multiple projects?
  • Both x32/x64 native libs have identical file names. Currently the lib ref is done with #pragma comment (lib, "xxxxxx.lib"). How should this be changed?

Lastly - VS2008 has only Win32 platform listed, not Win64 (I do have x64 VS2008 component installed).

Thanks!

+2  A: 

Normally it is sufficient to select the drop down which says win32 (next to the Debug/Release one on the toolbar) and selected "Configuration Manager". Then open the "Active Solution Platform" drop down and select New. Choose x64 type (which if it doesn't exist then 64bit compilers are not installed) and copy solution from the orignal Win32 one. Now your project can be built selectively by changing the drop down on the toolbar.

Normally it works more or less as is but you might want to consider tweaking a few pre-processor defines if only for the intellisense.

As for libraries, for platform ones (supplied as part of VS/PSDK) then you dont need to change anything. For your libraries you are wrapping then change the Additional Library Directories in the project properties to point to the 64bit directory.

tyranid
Unfortunatelly I do not see the x64 option in that dropdown, even though I do have C++ 64 bit installed. Can it be related to some other setting? I keep seeing various references to CLR:Safe, etc...
Yurik
I don't think there is any obviously option which would causes issues. Have you installed a later platform sdk which without the 64 bit compilers which might have overridden it?
tyranid
I only installed VS2008 with the C++ 64bit component checked, C#, etc. No additional SDKs as I didn't think it's needed?
Yurik
So when you get the New Solution Platform dialog you do not have any other option in the "Type or select new platform:" combo box?
tyranid
weird behaviour was fixed by a complete reinstall of VS-related components. Weird :(
Yurik
+1  A: 

Visual studio doesn't always install the 64 bit options.

It can be fixed by running the VS installer, choosing add/remove features, and checking the x64 feature.

TNT