# 13.1.概述

[WINE](https://www.winehq.org/)，即 *Wine Is Not an Emulator*（Wine 不是模拟器），严格来说是一个软件翻译层。它允许在 FreeBSD（以及其他系统）上安装和运行为 Windows® 编写的软件。

WINE 的工作机制是拦截系统调用，也就是软件对操作系统的请求，并将这些调用从 Windows® 的形式转换为 FreeBSD 能理解的形式。如有需要，它还会将系统响应翻译为 Windows® 软件所预期的格式。因此，在某些方面，它 *模拟* 了一个 Windows® 环境，因为它提供了 Windows® 应用程序所期望的许多资源。

然而，WINE 并不是传统意义上的模拟器。许多这类解决方案是通过软件进程模拟整个独立的计算机，以代替实际的硬件。虚拟化（比如通过 port [emulators/qemu](https://cgit.freebsd.org/ports/tree/emulators/qemu/) 提供的方式）正是这种方式。此方法的好处之一是可以在虚拟机中安装完整的目标操作系统，对应用程序来说，这个环境与真实机器没有区别，因此大多数软件在其中能正常运行。但这种方式的缺点在于，用软件模拟硬件本质上比真实硬件要慢。用软件构建的计算机（称为 *guest* 客体系统）需要占用真实机器（称为 *host* 宿主系统）的资源，并在运行期间持续占用这些资源。

相比之下，WINE 对系统资源的消耗要轻得多。它可以在运行时即时翻译系统调用，虽然它很难达到真正 Windows® 机器的速度，但可以非常接近。另一方面，WINE 需要不断追赶变化中的目标 —— 也就是不断演变的系统调用和功能支持。因此，有些应用程序在 WINE 上可能无法正常运行，无法运行，甚至无法安装。

总的来说，WINE 是另一种可选方案，可以尝试在 FreeBSD 上运行某个特定的 Windows® 程序。如果成功，它可以成为首选方案，既提供良好体验，又不会不必要地消耗宿主 FreeBSD 系统的资源。

本章将介绍：

* 如何在 FreeBSD 系统上安装 WINE；
* WINE 的工作方式，以及它与虚拟化等其他方案的不同；
* 如何针对某些应用程序的特殊需求微调 WINE；
* 如何为 WINE 安装图形界面辅助工具；
* 在 FreeBSD 上使用 WINE 的常见技巧与解决方案；
* 在多用户环境中使用 WINE 的相关考量。

在阅读本章之前，建议先：

* 了解 [UNIX® 与 FreeBSD 的基础知识](https://docs.freebsd.org/en/books/handbook/basics/#basics)；
* 知道如何 [安装 FreeBSD](https://docs.freebsd.org/en/books/handbook/bsdinstall/#bsdinstall)；
* 知道如何 [设置网络连接](https://docs.freebsd.org/en/books/handbook/advanced-networking/#advanced-networking)；
* 知道如何 [安装第三方软件](https://docs.freebsd.org/en/books/handbook/ports/#ports)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/hanbook/di-13-zhang-wine/13.1.-gai-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
