DoxigAlpha

addWin32ResourceFile

Resource files must have the extension .rc. Can be called regardless of target. The .rc file will be ignored if the target object format does not support embedded resources.

Function parameters

Parameters

#
m:*Module

Type definitions in this namespace

Types

#
CreateOptions
Unspecified options here will be inherited from parent `Module` when
Graph
Elements of `modules` and `names` are matched one-to-one.

Functions in this namespace

Functions

#
addImport
Adds an existing module to be used with `@import`.
addAnonymousImport
Creates a new module and adds it to be used with `@import`.
addOptions
Converts a set of key-value pairs into a Zig source file, and then inserts it into
addCSourceFiles
Handy when you have many non-Zig source files and want them all to have the same flags.
addWin32ResourceFile
Resource files must have the extension `.rc`.
addCMacro
Equvialent to the following C code, applied to all C source files owned by
getGraph
Intended to be used during the make phase only.

Source

Implementation

#
pub fn addWin32ResourceFile(m: *Module, source: RcSourceFile) void {
    const b = m.owner;
    const allocator = b.allocator;
    const target = m.requireKnownTarget();
    // Only the PE/COFF format has a Resource Table, so for any other target
    // the resource file is ignored.
    if (target.ofmt != .coff) return;

    const rc_source_file = allocator.create(RcSourceFile) catch @panic("OOM");
    rc_source_file.* = source.dupe(b);
    m.link_objects.append(allocator, .{ .win32_resource_file = rc_source_file }) catch @panic("OOM");
}