Install X Window Libraries And Headers On

Note: This article is for plugin developers. If you’re a user just trying to install a plugin, please see the “Expanding X-Plane” section of the X-Plane manual. (The exact method of installation depends on the plugin, but for many plugins, you can simply drop the plugin directory into your Resourcesplugins directory.)

To install a new library into your Arduino IDE you can use the Library Manager (available from IDE version 1.6.2). Open the IDE and click to the 'Sketch' menu and then Include Library Manage Libraries. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation. The X Window System (X11) is the de facto standard for graphical user interfaces in Unix. X is network-based, enabling applications started on one host to be displayed on another host connected over any kind of network (LAN or Internet). This chapter provides basic information on the X configuration, and background information about the use of.

Platform Choices & Decisions

X-Plane supports plugins for all three operating systems (macOS, Windows, and Linux). This article covers issues of building and packaging plugins.

Which API to Use

There are three revisions of the X-Plane plugin API:

  • 1.0 API is supported by X-Plane 6.70 and newer.
  • 2.0 API is supported by X-Plane 9.00 and newer, is a superset of the 1.0 API
  • 2.1 API is supported by X-Plane 10.00 and newer, is a superset of the 2.0 API
  • 3.0 API is supported by X-Plane 11.10 and newer, is a superset of the 2.1 API

Plugins are almost the same for all APIs; a few exceptions for compiling and linking 2.0+ plugins will be noted.

You can use the latest SDK download to build your plugin no matter what version of the API you are targeting. By default your plugin will only be able to use 1.0 APIs and run on any version of X-Plane.

If you define the symbol XPLM200, then the 2.0 API will be available to your code, and your plugin will only work on X-Plane 9 and later.

Likewise, if you define the symbol XPLM210, you’ll have access to the 2.1 API and your plugin will only work on X-Plane 10 and newer.

Finally, if you define the symbol XPLM300, you’ll get access to the 3.0 API, and your plugin will work X-Plane 11.10 and newer.

If you’re just starting out, we recommend using the SDK 3.0 API and defining XPLM200, XPLM210, and XPLM300.

If you’re building a backward-compatible plugin (say, for both X-Plane 10 and 11), you can link against the 2.0 API and use the XPLMFindSymbol() utility to optionally fetch newer APIs. If they are not present, your plugin will receive a NULL return value and can take a fallback path.

Install X Window Libraries And Headers On

Plugin Containers

Plugins are DLLs (dynamically linked libraries). While these have different names on different operating systems, the concept is the same: code that is linked into X-Plane while it is running. We will use the term DLL generically to mean a shared library of the appropriate type for your chosen ABI. The container types are:

  • DLLs (.dll) for Windows
  • Shared Objects (.so) for Linux
  • Shared Dynamic Libraries (.dylib) for macOS

Note that in all of these cases the plugin’s extension is .xpl, as dictated by SDK conventions, not the native platform.

Packaging Thin Plugins

A “thin” plugin is the original way of packaging plugins: the plugin consists of a single DLL with the extension .xpl, which is dropped into X-Plane’s Resourcesplugins directory. All auxiliary files (image files, etc.) must be kept outside the plugin. Thin plugins are the only packaging supported by the 1.0 API. (Originally thin plugins were just called “plugins”.)

The obvious downsides of this are that you have to distribute a different plugin for each operating system, and you don’t get a plugin “home” directory to pack your resources.

In order to build a thin plugin, make sure your plugin ends in the extension “.xpl”.

Packaging Fat Plugins (XPLM 2.0 API)

A “fat” plugin is a folder containing one or more plugins. The plugins inside the folder have the specific names win.xpl, mac.xpl and lin.xpl. A fat plugin provides a container format that is portable across multiple operating systems; X-Plane loads only the plugin that is appropriate for the host computer and ignores the rest. The folder can also contain support files, allowing the user to install the plugin by dragging a single folder.

Fat plugins require the 2.0 API, and are the recommended way of packaging plugins that would require the 2.0 API or X-Plane 9 for other reasons.

To build a fat plugin, make sure the actual binary is inside a folder (which in turn is inside the plugins folder) and that the binary is named win.xpl for Windows, mac.xpl for OS X, or lin.xpl for Linux.

The recommended layout for a fat plugin is:

Packaging Fat Plugins (XPLM 2.1 API)

New in X-Plane 10 are the 32-bit and 64-bit variants of fat plugins. In this case, the plugin packaging looks like this:

  • my_plugin/
    • 64/
      • mac.xpl
      • win.xpl
      • lin.xpl
    • 32/
      • mac.xpl
      • win.xpl
      • lin.xpl

(Note that you don’t need to ship both 32- and 64-bit variants of your plugins to use this packaging.)

Packaging Fat Plugins (XPLM 3.0 API)

As of X-Plane 11.10, we support one more format for packaging plugins. The downside to the 2.1 format is that all plugins are named [platform].xpl, which makes debugging tools hard, if not impossible, to use with shipping plugins. (They assume that all DLLs will have unique names, and therefore get confused if you have multiple plugins loaded that are both called, e.g., win.xpl.)

For that reason, as of XPLM 3.0, you can package plugins like this:

  • my_plugin/
    • mac_x64/
      • my_plugin.xpl
    • win_x64/
      • my_plugin.xpl
    • lin_x64/
      • my_plugin.xpl

(Note, of course, that X-Plane 11 supports only 64-bit plugins.)

Global, Aircraft, or Scenery Plugin

A “global” plugin is one that is installed in the Resourcesplugins folder. This is the original way to install a plugin and the only one supported by the 1.0 SDK. Global plugins must be installed directly into the plugins folder (which is in turn inside the Resources folder); sub-folders are not examined.

The 2.0 API also allows plugins to be stored with aircraft; such aircraft-based plugins are loaded when the user loads the plane (not counting multi-player use of the plane) and unloads the plugin when the user picks another aircraft.

The 2.1 API also allows plugins to be stored with a scenery pack; such scenery-based plugins are loaded at startup with the global plugins, so be sure to keep resource use to zero when the user is not in your scenery area.

Only fat plugins can be stored with an aircraft or scenery pack. An aircraft plugin goes in a “plugins” folder that in turn is inside the root folder of your aircraft package. A scenery plugin goes into a “plugins” folder that in turn is inside the root folder of your scenery package.

Compiling Plugins

This section describes some of the issues when compiling plugins. This document is not meant to be substitute for the original documentation for your development tools, nor is it meant to be instructional in this regard. You should be able to use your chosen tool set to build DLLs before you begin writing plugins.

The simplest way to compile your plugins is to start with one of the examples, which come with project files and perform all the setup described below.

Recommended Compilers

We do not recommend any particular compiler, but there are more SDK-related resources available for the compilers used to produce the basic examples. Those compilers are:

Install x window libraries and headers on windows
  • macOS: LLVM (via Xcode)
  • Windows: Visual Studio 2010 Express or Visual Studio 2015
  • Linux: GCC 4.x

The sample code provides templates that support these compilers. One way to get started is to download a sample and then replace the code while keeping the project.

Setting Up Defined Macros

In order to use the X-Plane SDK headers, you must pre-define some macros before including any SDK headers. This is usually done by setting up the definitions (a.k.a. preprocessor macros) in your compiler settings. Most compilers accept the command-line option -D<symbol>=<value>; Xcode and Visual Studio both have project settings to predefine symbols, and in both cases they result in -D command-line options being sent to the compiler.

You must define one of the macros APL, IBM, or LIN to 1, depending on the OS you are compiling for. If no platform is defined, you will get a “platform not defined” compile error as soon as you include any SDK headers. Typically you would define the platform in the project settings or make file for each platform, so that the code can be shared between all three without modification.

Macros for the 2.0 and newer SDK APIs

In order to use the 2.0 APIs, you’ll need to define the symbol XPLM200. To the the 2.1 APIs, you’ll need to also define XPLM210, and for the 3.0 APIs, you’ll need to define all three of XPLM200, XPLM210, and XPLM300.

(This feature is designed to let you build plugins that link against old versions of the SDK from the same SDK headers. If newer symbols are not defined, you cannot accidentally use a newer routine.)

Install X Window Libraries And Headers On Google

Including the SDK Headers

To use X-Plane SDK functionality, you must include the SDK headers, like this:

In order for this to work, you must tell your compiler where to locate the header files. You must first decide where to install the header files. There are two basic choices:

  • If you work on your projects by yourself, you can pick one location on your hard drive to place the SDK and use it for all of your projects. The advantage is you will only have one copy of the SDK to update in the future.
  • If you share your projects with other developers, it is important that the SDK location be the same for all developers, and be located relative to the project. (Otherwise all developers would need the same hard drive name.) In this case, it makes sense to copy the SDK headers and libraries into the source tree of each project.

Once you have decided on an install location, you must provide your installer with an include path that tells it where the headers are. For example,

Most compilers require one include path for each directory to be searched.

OpenGL Considerations

OpenGL is not part of the SDK, but it is the main API for drawing from plugins, so you will almost certainly need it to create any kind of custom graphics. OpenGL deployment varies a bit by platform.

On macOS, OpenGL is a framework, and it is always available. Using OpenGL requires two steps:

  1. Add the framework to your project in Xcode (or use -framework OpenGL on the command line).
  2. Include the headers like this:

For Windows and Linux, include OpenGL like this:

On Linux, you may have to first install a package, e.g.:

(Specific instructions for your distro may vary.)

DLL Attach Functions for Windows

Windows requires a “DLLMain” function to be included in your code. It is essentially boilerplate, and typically doesn’t have to do any useful work. Here is a sample DLLMain function:

Symbol Visibility (GCC4 or higher)

For GCC-based environments (command-line Linux), the default behavior is to export all non-static C functions out of your plugin. This is not what you want, and can cause serious compatibility problems for 32-bit plugins. To get around this, use

on your compiling command line.

The macro PLUGIN_API (defined by XPLMDefs.h) automatically marks a symbol as exported, so yo can do this:

and your plugin will work correctly.

Linking Plugins

Linking is the process of taking your compiled code and making an actual DLL file on disk that is your plugin.

Linking on Windows

You will need to link against XPLM.lib, found in the SDK under SDK/Libraries/Win. Link against:

  • 32bit plugins: XPWidgets.lib, XPLM.lib
  • 64bit plugins: XPWidgets_64.lib, XPLM_64.lib

If you are using OpenGL, you’ll also want to link against OpenGL32.lib.

We recommend you set all MSVC settings to avoid depending on external DLLs other than the CRT runtime; these DLLs may not be present on destination machines, and can cause your plugin load to fail. Linking the CRT runtime statically however will cause problems for users who have a lot of plugins installed and run out of TLS slots when loading plugins.

  • C++ Code Generation: set the runtime to “multi-threaded DLL”, not “multi-threaded.”
  • General: do not use common language runtime support or MFC.

Linking on macOS

You will need to add XPLM.framework and XPWidgets.framework from the SDK to your plugin; you may also need to add the system frameworks OpenGL and possibly System or CoreFoundation to your plugin depending on what Mac settings you use.

Do not use the options “-undefined_warning” or “-flat_namespace” – these are no longer needed and not recommended.

Linking on Linux

There are no link libraries on Linux for the SDK; instead pass the command-line option

to the linker. This will let you link despite not having XPLM symbols defined. To include libraries like OpenGL use this:

Finally, you may need to use a linker-script for your 32-bit plugin to avoid symbol collisions. To do this, create a file like this:

and then refer to it on the command line like this:

-->

Describes the installation, tools and supported libraries that make up a productive Direct3D 12 development environment.

Development environment

The Direct3D 12 headers and libraries are part of the Windows 10 SDK. There is no separate download or installation required to use Direct3D 12.

After you install the Windows 10 SDK software, and Visual Studio, the setup of your Direct3D 12 programming environment is complete. Visual Studio 2019 is recommended, as it will include the D3D12 graphics debugging tools, but earlier versions of Visual Studio will work for program development.

To use the Direct3D 12 API, include D3d12.h and link to D3d12.lib, or query the entry points directly in D3d12.dll.

The following headers and libraries are available. The location of the static libraries depends on the version (32-bit or 64-bit) of Windows 10 that is running on your computer.

Header or library file nameDescriptionInstall location
D3d12.hDirect3D 12 API header%WindowsSdkDirInclude%WindowsSDKVersion%um
D3d12.libStatic Direct3D 12 API stub library%WindowsSdkDirLib%WindowsSDKVersion%umarch
D3d12.dllDynamic Direct3D 12 API library%WINDIR%System32
D3d12SDKLayers.hDirect3D 12 debug header%WindowsSdkDirInclude%WindowsSDKVersion%um
D3d12SDKLayers.dllDynamic Direct3D 12 debug library%WINDIR%System32

Supported languages

Install

C++ is the only supported language for Direct3D 12 development, C# and other .NET languages are not supported.

Helper structures

There are a number of helper structures that, in particular, make it easy to initialize a number of the D3D12 structures. These structures, and some utility functions, are in the header D3dx12.h. This header is open source, and can be modified by a developer as required - download it from The D3D12 Helper Library and refer to Helper Structures and Functions for D3D12.

Memory Management Library

A memory management helper library is available for download that you can integrate into your app to more closely match D3D11 memory management behavior. As a D3D11 style management library, it is most effective with apps that are still using a committed resource style allocation strategy. In particular, the library should be seen as a stepping stone that will get you most of the way back to D3D11 performant memory management when in memory constrained scenarios (for example, low-end memory cards, 4k, ultra settings, and so on). D3D12 APIs do enable techniques that let you get even better memory efficiency over D3D11, though these techniques can be challenging and time consuming to implement.

Note that this library is a work in progress and may change over time. Use the links below to access the library, and samples.

Supported tools and libraries

The following libraries can all be used with Direct3D 12.

LibraryPurposeDocumentation
DirectX Tool Kit for DirectX 12A substantial collection of helper classes for writing Direct3D 12 C++ code for Universal Windows Platform (UWP) apps, Win32 desktop applications for Windows 10, and Xbox One exclusive apps.DirectX12TK wiki
DirectXTexUse this for reading and writing DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion.DirectXTex wiki
DirectXMeshUse this for performing various geometry content processing operations including generating normals and tangent frames, triangle adjacency computations, and vertex cache optimization.DirectXMesh wiki
DirectXMathA large number of helper classes and methods to support vectors, scalars, matrices, quaternions, and many other mathematical operations.DirectXMath documentation at MSDN
UVAtlasUse this for creating and packing an isochart texture atlas.UVAtlas wiki

Samples

For a list of working D3D12 samples and how to locate and run them, refer to Working Samples.

For walk-throughs on how to add code to enable particular features, refer to D3D12 Code Walk-Throughs.

Debug layer

The debug layer provides extensive additional parameter and consistency validation (such as validating shader linkage and resource binding, validating parameter consistency, and reporting error descriptions).

Note

For Windows 10, to create a device that supports the debug layer, enable the 'Graphics Tools' optional feature. Go to the Settings panel, under System, Apps & features, Manage optional Features, Add a feature, and then look for 'Graphics Tools'.

The header required to support the debugging layer, D3D12SDKLayers.h, is included by default from d3d12.h.

When the debug layer lists memory leaks, it outputs a list of object interface pointers along with their friendly names. The default friendly name is '<unnamed>'. You can set the friendly name by using the ID3D12Object::SetName method. Typically, you should compile these calls out of your production version.

We recommend that you use the debug layer to debug your apps to ensure that they are clean of errors and warnings. The debug layer helps you write Direct3D 12 code. In addition, your productivity can increase when you use the debug layer because you can immediately see the causes of obscure rendering errors or even black screens at their source. The debug layer provides warnings for many issues. For example:

  • Forgot to set a texture but read from it in your pixel shader.
  • Output depth but have no depth-stencil state bound.
  • Texture creation failed with INVALIDARG.

Set the compiler define D3DCOMPILE_DEBUG to tell the HLSL compiler to include debug information into the shader blob.

For details of all the debug interfaces and methods, refer to the Debug Layer Reference.

For overview information on using the debug layer, refer to Understanding the D3D12 Debug Layer.

Educational videos

Install X Window Libraries And Headers On Windows

There are a number of Direct3D 12 and Windows 10 related videos at DirectX advanced learning video tutorials, including videos on graphics debugging tools, and reporting graphics bugs.

Related topics