Unable to use Windres.exe with $Resource

Started by Quin, April 07, 2025, 10:30:43 AM

Previous topic - Next topic

Quin

If I try something like this, with windres on my path from winlibs:
$Resource "windres.exe"
Followed by some $BCX_Resource$ statements, the output of windres.exe is printed to the compiler's output list and it's not compiled properly. I've tried specifying arguments too, like:
$Resource "windres.exe $FILE$__.rc $FILE$__.res"
but this doesn't work either. Is what I'm trying to do possible?
-Quin.
GitHub

Robert

Quote from: Quin on April 07, 2025, 10:30:43 AMIf I try something like this, with windres on my path from winlibs:
$Resource "windres.exe"
Followed by some $BCX_Resource$ statements, the output of windres.exe is printed to the compiler's output list and it's not compiled properly. I've tried specifying arguments too, like:
$Resource "windres.exe $FILE$__.rc $FILE$__.res"
but this doesn't work either. Is what I'm trying to do possible?

Hi Quin:

Possible ? No, absolutely not possible.

Below is a description of how windres works.

Quotewindres reads resources from an input file and copies them into an output file. Either file may be in one of three formats:

"rc"
    A text format read by the Resource Compiler.
"res"
    A binary format generated by the Resource Compiler.
"coff"
    A COFF object or executable.

The exact description of these different formats is available in documentation from Microsoft.

When windres converts from the "rc" format to the "res" format, it is acting like the Windows Resource Compiler. When windres converts from the "res" format to the "coff" format, it is acting like the Windows "CVTRES" program.

When windres generates an "rc" file, the output is similar but not identical to the format expected for the input. When an input "rc" file refers to an external filename, an output "rc" file will instead include the file contents.

If the input or output format is not specified, windres will guess based on the file name, or, for the input file, the file contents. A file with an extension of .rc will be treated as an "rc" file, a file with an extension of .res will be treated as a "res" file, and a file with an extension of .o or .exe will be treated as a "coff" file.

If no output file is specified, windres will print the resources in "rc" format to standard output.

The normal use is for you to write an "rc" file, use windres to convert it to a COFF object file, and then link the COFF file into your application. This will make the resources described in the "rc" file available to Windows.


airr

Actually......

Instead of $RESOURCE, perhaps try $ONEXIT like this:

$ONEXIT "windres $FILE$__.rc -O coff $FILE$__.res"

AIR.

Quin

Airr,
You're a genius, thanks a ton!
This works!
-Quin.
GitHub