Foobar2000:Development:Overview

From Hydrogenaudio Knowledgebase
(Redirected from Foobar2000:Development)

What is a component

A foobar2000 component is a Windows Dynamic Link Library (DLL), or a Mac OS bundle with "component" extension, extending the functionality of the foobar2000 application.

A foobar2000 component implements one or more entrypoint services and interacts with services provided by foobar2000 core or other components.

Each component has a single exported DLL function, foobar2000_get_interface(), called on startup to initialize and discover entrypoint services of your component. This function is generated automatically by the foobar2000_component_client module. Do not implement it yourself.

foobar2000 components are made using foobar2000 SDK and Microsoft Visual Studio or Xcode.

See also: Visual Studio Compatibility, SDK Contents.

Packaging a component

Components are delivered to the user in form of fb2k-component file.

In old 32-bit foobar2000, this was originally a renamed zip of a component DLL.

In modern foobar2000, fb2k-component archive can contain multiple subdiretories with payloads for different processor architectures or operating systems.

If your component requires additional files, include them in the zip; foobar2000 will extract them to the folder containing your component DLL upon installation.

Different architectures

Delivering as straightforward zip-of-a-DLL still works, but that leaves it up to the user to download the correct binary.

To support multiple CPU architectures with one package, put files meant for legacy x86 foobar2000 in top level and create subdirectories named after the architectures, with files that are specialized for those architectures.

For an example, x64 foobar2000 will extract whole component archive, then overwrite files in root with those in x64 subfolder:

foo_sample.dll   <= this is for legacy x86 foobar2000
x64\foo_sample.dll   <= for x64 and arm64ec
arm64ec\foo_sample.dll   <= arm64ec foobar2000 will prefer this over x64 if provided
mac\foo_sample.component  <=  Mac OS bundle

Components packaged this way will let foobar2000 choose the right thing to load.

The components site now accepts such components and detects supported CPU architectures by listing zip contents.

Windows ARM support

foobar2000 for ARM is built in ARM64EC (Emulation Compatible) mode.

Because ARM64 Windows is still a niche platform, we cannot expect every developer to compile and test ARM64 components. foobar2000 for ARM64 is capable of seamlessly loading x64 components and transparently running them side by side with native components.

For non-performance-critical components, emulation of verified working x64 code is more than good enough, likely better than running untested ARM64 code if the developer has no means to test it.

See also: Foobar2000:Foobar2000 for ARM

Getting a component listed on foobar2000.org/components

Register a forum account and contact Peter with info about your component.

Further reading