Windows Store 平台移植 —— (2) 了解开发环境
2013-11-19 12:04
399 查看
1、Windows Store 相关技术
随着 Win8 的发布,微软有给我们带来一系列的新概念,包括:Windows Runtime
C++/CX
Windows Runtime C++ Template Library(WRL)
而一些原有的概念也与 Win 8 有关,比如:
COM
ATL
C++/CLI
.NET
2、C/C++移植相关技术
如果要将已有 C、C++ 程序移植到 Windows Store 环境,你应该了解的是:Win32 API
Win32 API 不是什么新东西,之前在 windows 上做过开发的人都应该知道,比如 Sleep、CreateFile 等等。但是进入到 Windows Store 环境,这些 API 能用的大概就剩一半了。不管微软出于什么目的,删除了的这些 API,这是我们必须面对的问题。
MSDN 链接:
Win32
and COM APIs
Windows Runtime
Windows 8 增加了 Windows Runtime,Windows Runtime 是一种面向对象的跨语言的框架,Windows Runtime 组件能够被 C++、VB、C#、Javascript 调用。反过来,我们也可以将 C++ 实现的功能通过 Windows Runtime 提供给其他语言调用。
Windows Runtime API
随着 Windows Runtime 而来的是,一些提供系统基本功能的 Windows Runtime 组件,称为 Windows Runtime API。在 C++ 中可以使用这些组件功能。
MSDN 链接:
Windows
APIs: Windows Runtime
C++/CX
全新的C++/CX(组件扩展)语言是对 C++ 的扩展。C++/CX 支持 C++0x 标准,比如 auto 关键字、lamba 表达式和 右值引用(&&) 等等。C++/CX 的扩展功能能够与 Windows Runtime 组件交互,通过扩展的 ref 类(结构体)语法、value 类(结构体)语法实现。我们要调用 Windows Runtime 组件功能,以及将已有 C/C++ 库的功能提供给 UI 和 其他语言调用,都有通过 C++/CX 达成目的。
MSDN 链接:
Visual
C++ 语言参考 (C++/CX)
Creating
Windows Runtime Components in C++
3、移植的基本思路
基于对 Windows Store 的了解,我们做 C/C++ 移植主要的任务有:Win32 API 补充
首先,我们需要通过 Windows Store 现有的 API 实现缺失的 Win32 API。实现的方式主要有下列几种:
通过 UNICODE 版本实现缺失的 ASCII 版本,比如 GetStringTypeExW -> GetStringTypeExA
通过提供相同功能的扩展版本 API 实现缺失的普通版本 API,比如 GetTickCount64 -> GetTickCount
通过 Windows Store 引入的替代功能 API 实现被替代的 API,比如 CreateFileMappingFromApp -> CreateFileMapping
通过 Windows Runtime API 实现一系列相关 API,比如 Windows::Socket 组件集 -> socket,WSASocket 系列 API
自行实现 Windows Store 没有的功能的 API,比如 GetEnvironmentVariable 环境变量功能
封装 Windows Runtime 组件
接着,需要将已有的 C/C++ 库封装为 Windows Runtime 组件,提供给其他代码调用。
相关文章推荐
- 深入浅出 - Android系统移植与平台开发(二) - 准备Android开发环境
- 深入浅出 - Android系统移植与平台开发(二) - 准备Android开发环境
- 深入浅出 - Android系统移植与平台开发(六)- 搭建基于Linux的Android开发环境
- 深入浅出 - Android系统移植与平台开发(六)- 搭建基于Linux的Android开发环境
- 深入浅出 - Android系统移植与平台开发(二) - 准备Android开发环境
- 深入浅出 - Android系统移植与平台开发(四)- 搭建Linux编译环境
- 深入浅出 - Android系统移植与平台开发(四)- 搭建Linux编译环境
- 深入浅出 - Android系统移植与平台开发(六)- 搭建基于Linux的Android开发环境
- Cocos2dx-3.0版本 从开发环境搭建(Win32)到项目移植Android平台过程详解
- 深入浅出 - Android系统移植与平台开发(二) - 准备Android开发环境
- Linux开发环境在pxa270平台上的搭建(1)——u-boot移植
- 使用CoCos2dx-3.4开发一套可以商用的跑酷游戏 之一 Win8平台的Cocos2dx环境搭建与知识预备
- 区块链开发(一)Windows平台搭建基于以太坊的区块链开发环境
- angularjs学习笔记一——了解angularjs、开发环境搭建、第一个angularjs程序
- Windows平台下CodeBlocks+Wxwidgets开发环境搭建
- 深入浅出 - Android系统移植与平台开发(八)- HAL Stub框架分析
- Windows/Mac平台下Visual Studio Code C++开发环境搭建
- Ubuntu14.04使用QEMU模拟ARM平台开发环境
- 深入浅出 - Android系统移植与平台开发(四)- Android启动流程
- OMAP平台开发环境搭建(Ubuntu下ftp服务配置)