C language > Beginner questions
Converting 32 bit code to 64 bit code
John Z:
Here is a nice summary about things to consider and do to convert 32 bit into 64 bit code.
It is from Oracle, June 2016 - yes I know I'm way behind :) :) :)
John Z
Vortex:
Hi John,
Thanks. Here is another link :
http://www.codeproject.com/Articles/17263/Moving-to-Windows-Vista-x64
John Z:
When upgrading another program to 64 bit I ran into this -
strlen() in 32 bit returns size_t which seems to be DWORD
strlen() in 64 bit returns size_t which seems to be unsigned long long int
so far so good - however in fileapi.h the WriteFile function
WINBASEAPI BOOL WINAPI WriteFile(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
doesn't change parm 3 so when compiling for 64 bits you get
Log_To_File.c(101): warning #2215: Conversion from 'unsigned long long int' to 'unsigned long int'; possible loss of data or unexpected result.
The only way I can see is either suppress the #2215 warning or cast (DWORD)strlen()
Doesn't seem to be a WriteFile64 .... and WriteFile is not marked as depreciated..
Thoughts?
John Z
So far upgrading from my old 32 bit programs to 64 bit has been relatively simple. Benefit is questionable other than future proofing against 32 bit support disappearing.
WiiLF23:
"If your application needs to handle large files and you want to work with 64-bit sizes, you might consider using the WriteFileEx function, which has a different signature that includes a LARGE_INTEGER parameter for the file offset. This function is designed to work with large files on 64-bit systems."
--- Code: ---WINBASEAPI BOOL WINAPI WriteFileEx(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPOVERLAPPED lpOverlapped,
LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
--- End code ---
John Z:
Thanks WiiLF23,
Appreciate the input - I did look at that and it seems overly complex for the simple log file entry.
There are other file methods of course, and it is just a warning, but to me it points out that 64 bit seems to not be fully implemented across the winbaseapi by Microsoft.
John Z
Navigation
[0] Message Index
[#] Next page
Go to full version