“#ifdef _MAC"有什么用?在 Windows 头文件中? [英] What's with "#ifdef _MAC" in Windows header files?

查看:21
本文介绍了“#ifdef _MAC"有什么用?在 Windows 头文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了 Windows 的平台 SDK 头文件(多么美好,对吧?),我注意到很多地方都包含对预处理器符号 _MAC 的引用.例如:

I was browsing through Windows's Platform SDK header files (what a life, right?), and I noticed many places contained references to the preprocessor symbol _MAC. For example:

// WinUser.h line 1568
/*
 * Message structure
 */
typedef struct tagMSG {
    HWND        hwnd;
    UINT        message;
    WPARAM      wParam;
    LPARAM      lParam;
    DWORD       time;
    POINT       pt;
#ifdef _MAC
    DWORD       lPrivate;
#endif
} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;

这是否意味着Macintosh",正如它所显示的那样?是否有一段时间可以为 Macintosh 编译 Windows 或 Windows 的子集?

Does this mean "Macintosh", as it appears? Was there a time where Windows or a subset of Windows could be compiled for the Macintosh?

推荐答案

曾经,Microsoft 是世界上最大的 Macintosh 软件开发商.Excel 和 Word 在 Macintosh 上占据了各自的市场,后来 Office 也占据了主导地位.因此,MS 的应用程序部门想要在 MAC 上运行的 Windows 头文件的子集并不奇怪 - 使他们的跨平台软件更易于维护.

At one time Microsoft was the largest developer of Macintosh software in the world. Excel and Word dominated their respective markets on the Macintosh, and later so did Office. So it's not that surprising that the applications division at MS would want a subset of the Windows header files that worked on the MAC - to make their cross platform software easier to maintain.

但从来没有任何版本的 Windows 操作系统可以在 Macintosh 上运行.

But there was never any version of the Windows OS that ran on the Macintosh.

无论如何,这个片段来自objidl.h,似乎表明_MAC确实意味着头文件中的Macintosh...

In any case, this fragment is from objidl.h, seems to indicate that _MAC does indeed mean Macintosh in the header files though...

//FSSpec is Macintosh only, defined in macos\files.h
#ifdef _MAC
    typedef struct tagSTATSTG
    {                      
        LPOLESTR pwcsName;
            FSSpec *pspec;
        DWORD type;
        ULARGE_INTEGER cbSize;
...
    } STATSTG;
#else //_MAC

这篇关于“#ifdef _MAC"有什么用?在 Windows 头文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆