开发者

porting from 32 bit to 64 bit

I have windows application build using Visual C++. Its being build and run on 32 bit windows env. Now I need to make sure it works on windows vista / 7 64 bit env. What all things I n开发者_开发知识库eed to consider for this porting process ??


That's not porting from 32bit to 64, that's just running your 32bit code on a 64bit machine to make sure it still works.

The way to do that is to just test all the functionality on the 64-bit machine, just as you do every time you release a new version, right? :-)

If you really want to port it (i.e., compile it to a 64bit executable), the first step is to just try it. You may find it works as-is. I'd only be worried about porting problems if you try it and then problems appear.

Then, and only then, would I go looking for the causes. Otherwise it's potentially wasted effort.


Porting guide: http://msdn.microsoft.com/en-us/library/aa384190(VS.85).aspx


Before building you project in x64 mode.

  1. Include all necessary 64 bit dll's required for your project
  2. Include Library files in linker - additional dependencies - configuration properties.
  3. Add necessary preprocessors in C\C++ - preprocessors - configuration properties.
  4. Enable the 64 bit warnings - When compiled the compiler shows warnings

Ex

  1. Conversion of datatype from int to size_t there might loss of data
  2. Storing pointer address
  3. Magic no.

refer the below link for more on errors and warnings while porting http://www.viva64.com/en/a/0065/


One think to watch out for is if you're storing plain old data (POD) into files or passing POD data to other apps via IPC or sockets etc. We also had code which assumed 4 byte longs and also assumed 4 byte pointers. Needless to say we removed these anachronisms.

Compilers are usually good at spotting the other kinds of errors, i.e. long to int conversions etc. So it's usually just a case of heeding your compilers warnings and altering your code accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜