Can I run 64 bit dlls on a 32 bit machine? - visual-studio

I have recently converted My visual studio solution to 64 bit from 32 bit. But, I have 1 machine which is running Windows Server 2003 (32 bit).Can I deploy and run these newly built 64 bit dlls on this 32 bit machine?

Basically, the answer is no.
If the underlying hardware is 32-bit, then it definitely won't support 64-bit instructions.
If the hardware is 64-bit (and the OS is just 32-bit), it's possible in theory, but would require the kernel to not only setup a 64-bit code segment, but to also setup 64-bit paging (I think). Since I doubt the 32-bit Windows kernel supports either of these, then it's not possible.

Yes you can using third party software like
http://www.vmware.com/products/
BUT don't expect much from the performance!

Related

What is the purpose of setting the platform target for a Visual Studio application?

For any VS project it is possible to set the platform target in the build properties of that project. You can set this to Any CPU, x86, x64 or Itanium. My question is, if I set this value to x86 does that mean I cannot run that project on a x64 machine? If so, why is this even used? Is it not better to just always use Any CPU?
if I set this value to x86 does that mean I cannot run that project on a x64 machine?
No, 32-bit applications (x86) run just fine on 64-bit Windows (x64). All 64-bit versions of Windows include a 32-bit compatibility layer called Windows on Windows 64 (WOW64). This is usually what you want, in fact, as most applications do not benefit from being complied for 64-bit.
However, compiling for 64-bit (x64) does mean that your app will not run on a 32-bit (x86) machine. You can go backwards (64-bit can run 32-bit), but you cannot go forwards (32-bit cannot run 64-bit).
Compiling for Any CPU is always an option, as you point out. That will allow the application to run as a 32-bit application (x86) on a 32-bit machine, and as a 64-bit application (x64) on a 64-bit machine. This sounds like a panacea, but there are costs. Most notably, you'll need to test your application extensively in both 32-bit and 64-bit environments, whereas if you only target 32-bit environments (including 32-bit environments on a 64-bit host), you only have to test one build. And the additional workload is rarely worth it—most business applications do not benefit from the extra memory space of a 64-bit environment, and probably end up defeating any potential gains by the increased overhead of 64-bit pointers.
Visual Studio itself is a good example of an application that is fully 32-bit. There is no 64-bit version, yet it runs fine on a 64-bit host. This blog post helps to shed some light on why the decision has been made to keep VS 32-bit. You might find the reasoning helpful in making the decision yourself.
Likewise, although Microsoft Office is now available in a 64-bit package, Microsoft is still recommending that most customers stick with the 32-bit version. There are compatibility problems with the 64-bit version, and there just isn't much benefit.
If you do not specify 32 bit platform the Microsoft application compatibility toolkit cannot determine the app is 32 bit and will not allow you to create a 32 bit solution file to allow an application to run without requiring admin credentials when user account control is turned on

Registering 32 and 64 bit DLL in a single MSI using WiX

I need to create a SINGLE Windows installer that performs the following tasks when it is run on the target m/c:
Runs a service
Registers a 32 bit DLL
Stores the 32 bit and 64 bit log4cxx.dll libraries in C:\Windows\sysWoW64 folder and C:\Windows\system32
Registers a 64 bit DLL
Currently, I am using WiX to create an installer and I am at a point where I can register either 32 bit OR 64 bit installer but not both. Unfortunately, I don't have the option of separating the 32 and 64 bit installer as I need to register both the installers on a 64 bit machine.
I would like to know if there was a way to register both the DLLs in one installer. Thanks in advance.
WiX doesn't support mixed 32/64-bit packages. So the only option is using separate packages:
A 32-bit package for 32-bit systems.
A 64-bit package which installs both 32-bit and 64-bit resources on a 64-bit machine.
Another solution is to use a different setup authoring tool which supports mixed 32/64-bit packages. Perhaps this list will help: http://en.wikipedia.org/wiki/List_of_installation_software

Compilation on 64-bit system for 32 bit system - compatibility

i have a 64-bit machine with 64-bit OS...
how can i compile programs with Visual Studio 2010 so that they work on 32-bit system
if i install 32-bit OS on my 64-bit machine than i thinks it won't be a problem
If you are talking about .NET applications simply verify that you are targeting x86 in the properties of your project (this is the default setting) or Any CPU:
This is a nice property of just-in-time compiled code. It runs just as well on a 32-bit machine (using the x86 jitter) as a 64-bit machine (x64 jitter). The only time you get in trouble is when you need to use legacy unmanaged code that's only available as 32-bit machine code. Not uncommon with old dbase providers (like Jet) and COM servers. You've got the right kind of machine to detect these problems early.
Emphasizing: you don't have a problem if the target machine is 32-bit, only if it is a 64-bit machine.

How to create an installer condition that test for 32 and 64 bit Windows

I am creating a visual studio set-up project. I need to test to see if the version of Windows I am being installed on is 64 or 32 bit. I am planning on checking for the existence of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node as a way of telling that I am being installed on 64 bit windows. Is this a good idea and/or is there a better way?
The reason that I want to know which version of Windows I am on is so I can create a directory under either System32 or SysWOW64. I would rather not create two installers one targeting 64 bit platforms and one targeting 32 bit platforms.
The easiest way to check for a 64 bit machine in an MSI installer is to use the VersionNT64 property. This will only be set if the target machine is running a 64 bit operating system.
http://msdn.microsoft.com/en-us/library/aa372497(VS.85).aspx

Using Visual Studio 2005 (32bit) on a Windows 7 64bit machine

I need to use Visual Studio 2005 (C++) on my new laptop - a Sony Vaio with Windows 7 64bit..
I don't need to develop for a 64bit environment, my work is all 32bit, so how can I be sure that I can still develop/debug/test for a 32bit target environment using VS2005 on a 64bit machine....?
What's the best option:
1) Just install VS2005 on Windows 7 64bit and carry on.. (suspect problems with 64bit runtime libs..?)
2) Dual boot the laptop with Windows XP 32bit.
3) Run some kind of Virtual Machine with Windows XP in it... (I don't have a VM yet, but would look into it)
Thanks
The answer is 1) you just need to make sure that you target processor is 32bit. You can develop for 32bit machine on a 64bit machine and vice versa.
After some looking around it looks like you must have up to date service packs. Read http://msdn.microsoft.com/en-us/vstudio/aa948853.aspx if you want to know more.
Visual Studio includes both 32-bit and 64-bit compilers and tools.
You can install VS on Windows 7 x64 and develop 32-bit applications without any problems.
(Just don't do something insane like hard-coding "C:\\Program File (x86)\\")
As the others have pointed out, both the 64 bit and 32 bit versions of VS can target both 64 bit and 32 bit runtime environments. Further you can use either the 64 or 32 bit versions of Windows 7 (obviously the 64 bit version of VS requires 64 bit Windows, but VS 32 bit runs on either).
But you have a second part to your question, debug/test on 32 bit. Depending on the kinds of applications you build, testing under Windows 7 64 bit alone may not be sufficient. You may want to test in a Windows XP virtual machine running under Windows 7, or in certain cases you may need a real 32 bit computer to test on.

Resources