We all know the Y2K problem , and this problem will arrive soon in 2038. All the Solution i was read it was say "use 64bit OS" , so i have a question; If my program was compiled with any 64-bit platform it`s possible to running on a machine that only work with 32-bit for example like old Pentium CPU? I was read some resource that say the int_64bit can be represent on 32bit machine by using two 32bit integer.
Simple Answer is
A program compiled for 64 bit platform can not run on 32 bit processor.
Timestamp is mainly application specific and Your programming language takes care of handling it and Operating System will take care of that.
See you need to understand 2 things
Compiling on a 64 bit platform doesn't mean you application is 64 bit. You can compile a 32 bit application on 64 bit platform.
Now see under the hood everything a program or an application that you run on you computer is executed by the processor, so every program is converted or object code or machine code at the end moment before its being executed by the processor and these "bits" actually represents the size of "registers" (kind of memory that processor uses) that your processor has. So the point is whenever a high level language like program C++ is converted to machine code. The compilers follow these steps (in simple terms)
Your Source Code ---> Convert to System specific Assembly ---> Binary Code
Then this binary code is executed by the processor.
Now see that I mentioned Assembly language is machine/processor specific. Its different for ARM processors, x86 Processors, PowerPC Processors etc..(these are processor architectures)
Now in your case lets assume we are now thinking how an 32 bit Intel processor (x86) is gonna run 64 bit Program
You wrote a program for adding to numbers 10 and 20 and compiled the binary for running directly on a processor (for time being forget about OS and Its Libs)
Now lets see "Your Source Code" converted to both 32 bit Assembly Program as well as 64 Bit Assembly Program
Assembly Output (32 Bit or x86 Code)
mov eax, 10
add eax, 20 ;OUTPUT IS SAVED TO "EAX" REGISTER WHICH IS A 32 BITS REGISTER
Assembly Output (64 Bit or x86_64 Code)
mov rax, 10
add rax, 20 ;OUTPUT IS SAVED TO "RAX" REGISTER WHICH IS A 64 BIT REGISTER
Now these Assembly program is line by line converted to binary code
When you run the output binary of the 64 bit code on a 32 bit processor then 32 bit processor doesn't even know what "RAX" is, that will immediately cause an Interrupt (Error from Processor)
Image of a Processor Register is shown in the figure (x86_64 specific)
There are many registers available inside a processor for simplicity I'm just using EAX and RAX register of x86_64 processor. For an x86_64 Processor (64 bit) knows what these "RAX" and "EAX" means. But a 32 bit Processor(x86) wont understand what an "RAX" means. Thats the only reason why 32 bit programs can run on a 64 bit machine and the opposite is not possible....
Note : Its not just Registers there can be processor specific instructions. All the instructions that is supported by a newer processor may not be supported by an older processor.
Example: " imul reg, reg " (Integer Multiplication) instruction is only available from Intel 80386 and above
I know its a bit confusing. Its a bit complicated topic to explain. Still I hope this solves your issue.
Related
I have written a program in Java on a 64 bit Window OS, but now I need my program to work on a 32 bit Window OS. How can I do this? (For making an exe file I used launch4j)
For Java, if the machine has the Java 32-bit is installed, then running the exe alone will be enough. If you want to provide redistributable, just use the java 32-bit redistributable.
I wrote an application with Qt 4.8.1 and MinGW32 (Nokia Qt SDK). I try to load a large file with this app, but the app always crash when memory usage reach 1,868 MB. If I reduce the size of input file the app works fine. Is there any memory limitations on Qt apps or MinGW32? What should I do if I really want my app to use more memory? My windows is 64 bit.
p.s. Adding "QMAKE_LFLAGS_WINDOWS += -Wl,--stack,32000000" to .pro file won't work
Thanks very much!
p.p.s. I saw many software are capable of using 10+ GB, e.g. Matlab, how to do that on Qt apps?
Your copy of windows may be 64 bit, but MingW32 is a 32 bit compiler, so any app written with that compiler has all the standard limits inherent to 32 bit Windows. Effectively, you won't be able to get more than around 2G of memory for your app to use.
There's a method to get that up to 3G, but beyond that you need a 64 bit compiler.
2GB is limit is for process only.
You can spread your application along N processes (32-bit) to allocate N x 2GB. Operating system must still be 64-bit.
I'm having issues with redemption because Outlook 32 bit can be installed on a 64 bit machine. The RedemptionLoader doesn't determined the bit version of Outlook installed on a 64 bit machine. Has anyone run into this before?
The problem is that you can't use 32 bit DLLs in 64 bit processes. But there's a workaround I've found after a long period of search.
It's possible to run the 32 bit Redemption-DLL in a 32 bit DllHost.exe process. Now you're able to access this DllHost.exe*32 by your x64 or AnyCPU application, because THAT is possible.
That sounds complicated but is relatively simple.
First register your Redemption.dll (x86) on the system. I've done it this via:
regsvr32.exe "C:\Program Files (x86)\Redemption\Redemption.dll"
If you start your application without registering the Redemption.dll you'll get an exception like:
COMException: Retrieving the COM class factory for component with CLSID {29AB7A12-B531-450E-8F7A-EA94C2F3C05F} failed due to the following error: 80040154 Klasse nicht registriert (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Once the 32 bit DLL ist registered you need to add some keys and values to your Registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Wow6432Node\AppID\{29AB7A12-B531-450E-8F7A-EA94C2F3C05F}]
"DllSurrogate"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{29AB7A12-B531-450E-8F7A-EA94C2F3C05F}]
"AppID"="{29AB7A12-B531-450E-8F7A-EA94C2F3C05F}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{29AB7A12-B531-450E-8F7A-EA94C2F3C05F}]
"DllSurrogate"=""
What's now happening when start your application is that the system starts a DllHost process which loads the Redemption.dll in a x86 environment. You will see a dllhost.exe*32 with a COM Surrogate description on task manager, after you've started your x64 application. All accesses to Redemption.dll will now be routed to the DllHost.
Of course you have to add these registry keys only on x64 systems with a x86 Outlook client ;)
Hope this will help some of you :)
RedemptionLoader does not determine Outlook bitness because it won't do you any good: it determines the bitness of the calling process and loads the appropriate version of Redemption (32 vs 64 bit), but that can raise an error if the bitness of your process/Redemption is different from the Outlook bitness. A 32 bit dll cannot be loaded by a 64 bit process.
See http://www.dimastr.com/redemption/faq.htm#ErrorCreatingRedemptionObject for more details.
It is possible to load a 32 bit DLL in a 64 bit PowerShell session. See my answer here for more details.
In short, you can use Start-Job -RunAs32 which loads a 32 Bit PowerShell version
I have an ActiveX control which needs to be deployed in client machine and i am planning to do this by supplying installers to the clients .
I have made separate msi packages for 64 and 32 bit operating systems and it works properly.
However , i face a problem when it comes to 64 bit machines since i have the following requirement ,
In case of 32 bit machine install 32 bit ActiveX control.
In case of 64 bit machine install both 32 and 64 bit ActiveX control.
I read many articles stating hybrid installations cannot be done using basic msi installers ?
Can this be done using a single setup.exe file ?
A single MSI cannot both install files or registry to 64-bit locations on a 64-bit system and run on a 32-bit system. So assuming your 64-bit ActiveX control must be installed to or registered in a 64-bit location, you cannot do this in a single MSI.
If you have the premier edition of InstallShield 2012, this is one of the use cases of the Suite (or Suite/Advanced UI) project type. You must create two MSI files, and include them both in the suite with relevant eligibility conditions. (The exact conditions depend on whether you make the MSIs standalone or cumulative, but the 64-bit MSI should only be eligible if the platform has an architecture of x64.)
You can have both 32bit and 64bit components within a single installer and make it to decide what to install depending on the target platform as below.
1) Create two new features(one for 32 and one for 64) and add conditions to both of them.
for 32 bit -> Not VersionNT64
for 64 bit -> VersionNT64
2) Add both prerequisites and select appropriate (parent) feature for each one
I recently installed a 64bit OS on my computer, I thought that sizeof(char*) would give me 8 instead of 4. Shouldn't I get a 64 bit addresses in my pointers?
This is because the compiler you are using is emitting 32 bit code. If you use a 64 bit compiler then pointers will be 8 bytes wide.
Note that most 64 bit systems have the ability to run 32 bit code under an emulation layer. On Windows the emulation layer is known as WOW64. This is clearly what is happening here.
The OS typically has no effect on code generation. If you run the same compiler and the same libraries, you will get the same code out, regardless of whether the OS is 32-bits or 64-bits. You can compile and run 32-bit software on a 64-bit OS. You can compile 64-bit software on a 32-bit OS.
The compiler determines the type of code generated. The OS only determines whether you can run it.
Yes, you should, but note that a same operating system can run both 32-bit and 64-bit code, and that in the "64bit OS" you installed, the "64bit" may only mean "64bit able".
You really should give more detail here about the particulars of the OS. Mac OS X Snow Leopard , for instance, comes with versions of GCC and Clang that default to 64-bit code, and you can use option -m32 to generate 32-bit code. Perhaps the convention is reversed on your 64-bit OS (that is, you should use -m64 or a similar option)