Building C# bindings for ADLX

This guide outlines the steps to build a C# binding wrapper for ADLX, a prerequisite to programming with ADLX in a C# application.

Prerequisite(s)

  • ADLX SDK is installed.

  • Visual Studio 2019 is installed.

  • swigwin 4.0.2 is installed, and the path to the swigwin 4.0.2 installation is added to the Path user environment variable.

To build ADLX bindings in C#

  1. Create and name a folder for the C# ADLX binding wrapper, for example ADLXCSharpBind.

  2. Create a new file in the ADLXCSharpBind folder and title it ADLXCSharpBind.i.

  3. Edit ADLXCSharpBind.i and add the SDK header files for the interfaces you wish to wrap by using the SWIG input format. To create bindings for event notifications, turn on the director wrapping callback for respective listener interfaces.

    For example,

    Copied!

    feature("director") IADLXDisplayListChangedListener;

    Note: Refer to the C# samples ADLXCSharpBind.i file for an example of a C# binding.

  4. Create a C++ Dynamic Link Library project named ADLXCSharpBind and configure the project as follows:

    • Key

      Value

      Observations

      C/C++ > Precompiled Header

      Not Using Precompiled Headers

      Do not use precompiled headers

  5. Add the ADLXCSharpBind.i file to the project.

  6. Right-click the ADLXCSharpBind.i file, and select Properties from the menu. In the Properties dialog select Configuration Properties> General> Item Type> Custom Build Tool.

    Set the configuration as follows:

    • Key

      Value

      Observations

      Command Line

      if not exist $(SolutionDir)out mkdir $(SolutionDir)out swig.exe -c++ -csharp -dllimport ADLXCSharpBind -outdir ../out/ ADLXCSharpBind.i

      Invoke SWIG.exe to build ADLXCSharpBind.i file

      Outputs

      %(Filename)_wrap.cxx

      Set output file name format

  7. Build the project.

    Result: The following files are added to the ADLXCSharpBind project output folder:

    • ADLXCSharpBind_wrap.h file.

    • ADLXCSharpBind_wrap.cxx file.

    • All *.cs files that correspond to the additional interfaces in the ADLXCSharpBind.i file.

  8. Add the following files to the project:

    • ADLXCSharpBind_wrap.h

    • ADLXCSharpBind_wrap.cxx

    • SDK/Platform/Windows/WinAPIs.cpp

    • SDK/ADLXHelper/Windows/Cpp/ADLXHelper.h

    • SDK/ADLXHelper/Windows/Cpp/ADLXHelper.cpp

  9. Rebuild the project.

    Result: The ADLXCSharpBind.dll is built in the "$(SolutionDir)$(Platform)$/(Configuration)/" folder.

Related pages

  • Visit the Adlx product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNA™ 2 GPUs, AMD Ryzen™ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!