Question

What MIDL data types should I use to declare interface method parameters of C++ data types like size_t, void*, HBITMAP and other types of winapi handles (HANDLE, HFONT, etc.)?

Was it helpful?

Solution

size_t is implementation defined, but using Visual Studio's CRT, it's an unsigned 32-bit integer when compiling for 32-bit architectures and an unsigned 64-bit integer when compiling for 64-bit architectures. You'll want to use unsigned __int3264, which is 32 bits on a 32-bit architecture and 64 bits on a 64-bit architecture.

void* is another platform dependent type. MIDL provides a void* type, but it's only a 32-bit pointer regardless of the targeted address size, I believe. You may want to use the unsigned __int3264 type, instead.

MIDL provides types with the same names as the various handle type, though I'm not sure if all handle types are included; I know HBITMAP is, at least.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top