Building Java bindings for ADLX

This guide outlines the steps to build a Java binding wrapper for ADLX, a prerequisite to programming with ADLX in a Java 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.

  • OpenJDK 17 is installed.

  • The path to the OpenJDK 17 installation is added to the JAVA_HOME system environment variable.

  • The bin path for the OpenJDK 17 installation is added to the Path system environment variable.

To build ADLX bindings in Java

  1. Create and name a folder for your Java ADLX binding wrapper, for example ADLXJavaBind.

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

  3. Edit ADLXJavaBind.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 director wrapping callback for the respective listener interfaces.

    For example,

    Copied!

    feature("director") IADLXDisplayListChangedListener;

    Note: Refer to the Java samples ADLXJavaBind.i file for an example of a Java binding.

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

    • Key

      Value

      Observations

      VC++ Directories > Include Directories

      $(JAVA_HOME)/include and $(JAVA_HOME)/include/win32

      Add path of java include and path of java/win32 include

      C/C++ > Precompiled Header

      Not Using Precompiled Headers

      Do not use precompiled headers

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

  6. Right-click the ADLXJavaBind.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++ -java -package out -outdir ../out/ ADLXJavaBind.i

      Invoke SWIG.exe to build ADLXJavaBind.i file

      Outputs

      %(Filename)_wrap.cxx

      Set output file name format

  7. Build the project.

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

    • ADLXJavaBind_wrap.h file.

    • ADLXJavaBind_wrap.cxx file.

    • Several *.java files.

  8. Add the following files to the project:

    • ADLXJavaBind_wrap.h

    • ADLXJavaBind_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 ADLXJavaBind.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!