Porting - Shared Memory x32 & x64 processes

Posted by dpb on Stack Overflow See other posts from Stack Overflow or by dpb
Published on 2012-09-23T20:21:42Z Indexed on 2012/09/23 21:37 UTC
Read the original article Hit count: 296

Filed under:
|
|

A 32 bit host Windows application setups shared memory (using memory mapped file / CreateFileMapping() API), and then other 32 bit client processes use this shared memory to communicate with each other.

I am planning to port the host application to 64 bit platform and once it is ready, I intend that both 32 bit and 64 bit client processes should be able to use the shared memory setup by the main 64 bit host application.

The original code written for host x32 application uses "size_t" almost everywhere, since this differs from 4 bytes to 8 bytes as we move from x32 to x64, I am looking for replacing it.

I intend to replace "size_t" by "unsigned long long", so that its size will be same on 32 bit & 64 bit.

Can you please suggest me better alternative? Also, will the use of "unsigned long long" have performance impact on x32 app .. i guess yes?


Research Done - Found very useful articles - a) 20 issue in porting from 32 bit to 64 bit (www.viva64.com) b) No way to restrict/change "size_t" on x64 platform to 4 bytes using compiler flags or any hooks/crooks since it is typedef

© Stack Overflow or respective owner

Related posts about Windows

Related posts about winapi