Linking to kernel32.lib in 64-bits?
Question
Wednesday, October 1, 2008 4:14 AM
Newbie question:
I am new to C++ programming, and need to build some sample code for x64.
I see that the project is linking to files such as kernel32.lib and user32.lib. Does the "32" in the name imply that these are 32-bits? Why are they required even in a 64-bit build?
Do I need to swap in some 64-bit equivalents to remain truly 64-bit?
Regards,
Dave in San Fran
All replies (2)
Wednesday, October 1, 2008 6:39 AM âś…Answered
In the case of kernel32 and user32, the "32" is a holdover from the 16 to 32-bit transition era. For the 32 to 64-bit transition, for better or worse (mostly better), MS decided not to change the file names, so there will be two different kernel32.lib and user32.lib files to link against -- one for 32-bit code and one for 64-bit code.
So to answer your question, for 64-bit code you still want to link against kernel32.lib and user32.lib, you just need to make sure they're the 64-bit versions of the libraries. Assuming you haven't changed Visual Studio's default library files settings, the proper .lib will be linked in automatically.
Wednesday, October 1, 2008 4:11 PM
Thanks for the quick response.
I had a hard time finding documented details, so I appreciate the description.