摘要跨平台是软件开发中一个重要的概念,即不依赖于操作系统,也不信赖硬件环境。一个操作系统下开发的应用,放到另一个操作系统下依旧可以运行。相对而言假如某种计算机语言不用修改代码即可做到高度跨平台,那么此语言就越抽象,硬件控制力就越低,只适合开发高度抽象的模型系统。文中提到的当下比较流行的开源库如 Boost,Qt, ZThreads,Ptypes,这些开发库各有各的侧重点,在性能和框架设计上各有不同,本文会依次简要分析这些开发库的设计原则,概括总结跨平台有两种实现方式,利用分支技术,或者利用动态平台识别,例如 Java 是一种提供运行环境的跨平台解决方案,而C 只是一种标准且严格的跨平台语言,本文就是主要探讨 C 的跨平台库实现。本文会简要分析几种跨平台的技术实现和区别,并通过对实现方法的总结,而借用一种叫做核心和路由的技术来实现跨平台库的构架,并给出相应实现,最后配上相应的演示功能程序。关键词:跨平台、开源库、Boost、线程库AbstractCross-platform software development is an important concept, that is not dependent on the operating system, do not trust the hardware environment. An operating system developed under the application can still run into another operating system. In contrast If a computer language without modifying the code to achieve a high degree of cross-platform, then the more abstract language, lower hardware control, only suitable for the development of highly abstract model system.Current popular open source libraries such as Boost, of Qt, ZThreads, Ptypes, each of these development libraries each focus on performance and frame design different, this article will be followed by a brief analysis of the design principles of these development libraries, text summary cross-platform implemented in two ways, a branch of technology, or the use of a dynamic platform to identify, for example, Java is a cross-platform operating environment solutions, and C is a standard and rigorous cross-platform language, this paper focuses on C cro...