Skip to content

Stringify operator discrepancy with rc.exe's preprocessorΒ #16

@Michaelangel007

Description

@Michaelangel007

It looks like the Stringizing operator in a macro isn't supported.

Running this minimal test case bug.rc under resinator.exe ...

#define MY_VERSION     1,2,3,4
#define str(a)         #a
#define xstr(a)        str(a)
#define MY_VERSION_STR xstr(MY_VERSION)

#define ID_TEST 100

STRINGTABLE
BEGIN
    ID_TEST  MY_VERSION_STR
END

... generates this error log:

error: failed during preprocessing:

bug.rc:10:14: error: expected 1 argument(s) got 4
    ID_TEST  MY_VERSION_STR
             ^
bug.rc:4:24: note: expanded from here
#define MY_VERSION_STR xstr(MY_VERSION)
                       ^
bug.rc:3:24: note: expanded from here
#define xstr(a)        str(a)
                       ^
1 error generated.

This file compiles fine with Microsoft's rc.exe producing bug.res:

00000000: 00 00 00 00 20 00 00 00  FF FF 00 00 FF FF 00 00  .... ...........
00000010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
00000020: 2E 00 00 00 20 00 00 00  FF FF 06 00 FF FF 07 00  .... ...........
00000030: 00 00 00 00 30 10 09 04  00 00 00 00 00 00 00 00  ....0...........
00000040: 00 00 00 00 00 00 00 00  07 00 31 00 2C 00 32 00  ..........1.,.2.
00000050: 2C 00 33 00 2C 00 34 00  00 00 00 00 00 00 00 00  ,.3.,.4.........
00000060: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................

I verified the bug.res file is valid via:

  • Using cvtres /machine:X64 bug.res to convert it to an .obj
  • Linked the bug.obj to an .exe, and
  • Used resdump.exe to dump the resource:
Win64 Portable Executable (PE) file:
#0001A600
STRINGTABLE    #00000007h
Language 1033 (US English)
  100 (  64h) "1,2,3,4"

Any chance of updating resinator to support stringify / stringizing?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions