Skip to content

Recognize the .res extension and link it as if it were an object file#16191

Merged
andrewrk merged 1 commit into
ziglang:masterfrom
squeek502:recognize-res
Jun 25, 2023
Merged

Recognize the .res extension and link it as if it were an object file#16191
andrewrk merged 1 commit into
ziglang:masterfrom
squeek502:recognize-res

Conversation

@squeek502
Copy link
Copy Markdown
Member

@squeek502 squeek502 commented Jun 24, 2023

.res files are compiled Windows resource files that get linked into executables/libraries. The linker knows what to do with them, but previously you had to trick Zig into thinking it was an object file (by renaming it to have the .obj extension, for example).

After this commit, the following works:

zig build-exe main.zig resource.res

or, in build.zig:

exe.addObjectFile("resource.res");

Closes #6488 (first baby steps towards #3702)


Basic example of embedding an icon in a .exe so that it shows up in explorer:

zig-ico-exe

.res files are compiled Windows resource files that get linked into executables/libraries. The linker knows what to do with them, but previously you had to trick Zig into thinking it was an object file (by renaming it to have the .obj extension, for example).

After this commit, the following works:

    zig build-exe main.zig resource.res

or, in build.zig:

    exe.addObjectFile("resource.res");

Closes ziglang#6488
@andrewrk andrewrk enabled auto-merge (rebase) June 24, 2023 22:39
@andrewrk andrewrk merged commit b111702 into ziglang:master Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cannot embed windows resource file in latest version zig

2 participants