Login to OSNews
Username or Email
Migrating 32-bit Applications to 64-bit
on Tue 22nd Feb 2011 19:52 UTC, submitted by
Your company is ready to upgrade its custom applications from 32-bit to 64-bit. (Finally.) Here's
to help you make the transition as painless as possible.
Thread beginning with comment 463857
To view parent comment,
To read all comments associated with this story, please
on Thu 24th Feb 2011 18:18 UTC in reply to "
The thing for application developers to watch for is imperfect casts. If an app calls "SendMessage( hWnd, blah, blah, (LONG)(mystruct *)foo);" then on Win32 this will work fine, but on Win64 will cause a subtle pointer truncation. if (LPARAM) were used instead of (LONG) things would be fine, but on Win32 those are the same type.
Yes, but again if you follow the API call structure you will be fine, in this case use LPARAM, WPARAM rather than what they happen to be defined as. Which is why it is important to never assume anything about API types since they can change 'behind the scenes' which can break your application if you 'assume' anything. When dealing with foreign code that you can't manipulate, simply stick to the interface provided or set yourself up for a potential ton of headache.
on Sat 26th Feb 2011 08:58 in reply to "
Yes, but again if you follow the API call structure you will be fine, in this case use LPARAM, WPARAM rather than what they happen to be defined as. Which is why it is important to never assume anything about API types since they can change 'behind the scenes' which can break your application if you 'assume' anything.
This triggered some long lost repressed memory. I went back to my archives, and sure enough, WPARAM/LPARAM didn't originally exist - Windows 3.0 and earlier used WORD and DWORD directly. WPARAM/LPARAM were created to facilitate the move to Win32 (where WPARAM moved from 16 to 32 bits.) But any code that predates that - and there is a surprising amount - might have just been coded with the documented and defined type, and now find itself broken.
Sign Up For The OSNews Newsletter!
Friends & Fans
OSNews Privacy Statement
Notice to Bulk Emailers
© 1997-2015 OSNews Inc. All Rights Reserved. OSNews and the OSNews logo are trademarks of OSNews.
Source Code © 2007-2015,
, except where noted
Reader comments are owned by the poster. We are not responsible for them in any way.
All trademarks, icons, and logos shown or mentioned in this web site are the property of their respective owners.
OSNews.com uses icons from the
© 2008 John Resig
Reproduction of OSNews stories is permitted only with explicit authorization from OSNews. Reproductions must be properly credited.