Resources

Resources are non-code data, such as images, text, audio or other files, that will be included in your application and can be accessed from code at runtime.

Different kinds of resources are supported on different platforms. In most cases, resources are packed up to be included inside the binary file generated by the compiler or linker; on the Cocoa (Cocoa and Island/Darwin platforms, resources usually remain standalone files inside the Application Bundle.

There are three broad types of resources:

EmbeddedResource

EmbeddedResource files are supported on all platforms, but only very commonly used on .NET and native Island/Windows. As part of the build process, EmbeddedResource files get included in the main executable by the compiler or linker.

On .NET and Java, files of any types can be included as EmbeddedResource. Certain resource types will (based on file extension) be processed and packaged up differently. On Cocoa and all Island platforms, only .res resource files can be included. (A small and specific set of other file types can be set as EmbeddedResource and will automatically packaged as .res file during the build.)

  • .resx files are XML-based files that can contain values or reference to other (usually binary or media, such as bitmaps or icons) files. They will be converted to .resource files that include the data of any reference files, before being embedded.

  • .dfm files are text based files that define Delphi VCL forms. They will be converted to a binary format appropriate for the platform, before being embedded.

  • .rc files are text based files that describe Win32 resource; similar to .resx, they can contain references to other (typically binary or media) files. A future version of EBuild will automatically compile .rc files to .res files, but for now, these files cannot be directly referenced and must be compiled externally using the rc.exe tool that comes with the Windows SDK.

  • .res files contain a set of resources packaged up in a Windows-specific binary format. They will be embedded as is, and are supported on all platforms.

On the .NET and Java platforms , all other files will be embedded as is, and can be accessed directly using the appropriate resource APIs for the platform. On Cocoa and Island, arbitrary resource files are not supported, only .res files (or files from the above list that can be processed to .res files).

How embedded resources are accessed at runtime depends on the platform. Please refer to the following topics to get started:

Resource

Resource files are supported on .NET only. They too are embedded in the executable, but packaged in a different internal format and accessed using different code patterns than EmbeddedResources. They are most commonly used in WPF applications, and built on top of the .NET infrastructure for EmbeddedResources.

See Also Accessing WPF Resources (.NET).

AppResource

AppResource files are supported only on the Apple (Cocoa and Island/Darwin platforms. Any type of file (or even folder) can be marked as AppResource, and the file (or folder) will be copied "as is" into the .app Application Bundle.

See Also Accessing App Resources (Cocoa and Darwin)