WRC(1)

NAME
wrc - Wine Resource Compiler

SYNOPSIS
wrc [options] [inputfile]

DESCRIPTION
wrc compiles resources from inputfile into win16 and win32 compatible binary format. wrc outputs the binary data either in a standard .res formatted binary file, or an assembly file. wrc is also capable of reading .res formatted files and convert them into an assembly file.

The source-file is preprocessed with a builtin ANSI-C compatible preprocessor before the resources are compiled. See PREPROCESSOR below.

wrc takes only one inputfile as argument. The inputfile has extension .rc for resources in source form and .res for binary resources. The resources are read from standard input if no inputfile is given. If the outputfile is not specified with -o, then wrc will write the output to inputfile.{s,h,res} with .rc stripped, depending on the mode of compilation. The outputfile is named wrc.tab.{s,h,res} if no inputfile was given.

OPTIONS

-a n
    Win16 only; set the alignment between resources n. The alignment must be a power of 2. The default is 4.

-A  Obsolete; include code in the assembly output to auto register resources by calling a special wine function (only with gcc 2.7 and better).

-b  Create an assembly file from a binary .res file.

-B x
    Win32 only; set output byte-ordering, where x is one of n[ative], l[ittle] or b[ig]. Only resources in source-form can be reorderd. Native ordering depends on the system on which wrc was built. You can see the native ordering by typing wrc -?.

-c  Add 'const' prefix to C constants when writing header files.

-C cp
    Set the resource's codepage to cp. Default codepage is 0.

-d n
    Set debug level to n. The value is a bitmask consisting of 1=verbose, 2=dump internals, 4=resource parser trace, 8=preprocessor messages, 16=preprocessor scanner and 32=preprocessor parser trace.

-D id[=val]
    Define preprocessor identifier id to (optionally) value val. See also PREPROCESSOR below.

-e  Win16 only; disable recognition of win32 keywords in 16bit compile. Normally, all keywords are recognized in win16 compilation mode. Use this switch if old sources use win32 reserved names as resource names.

-E  Preprocess only. The output is written to standard output if no outputfile was selected. The output is compatible with what gcc would generate.

-g  Add symbols to the global C namespace. This makes all symbols available for linking by other modules.

-h  Generate a .h header-file. The resource tables are described by extern declarations.

-H file
    Same as -h but written to file.

-I path
    Add path to include search directories. Path may contain multiple directories, separated with ':'. It is allowed to specify -I multiple times. Include files are searched in the order in with the -I options were specified.
    The search is compatible with gcc, in which '<>' quoted filenames are searched exclusively via the -I set path, whereas the '""' quoted filenames are first tried to be opened in the current directory. Also resource statements with file references are located in the same way.

-l lan
    Set default language to lan. Default is the neutral language 0 (i.e. "LANGUAGE 0, 0").

-L  Leave case of embedded filenames as is. All filenames are converted to lower case before they are attemped to be opened without this option.

-m  Do not remap numerical resource type-IDs onto standard resources. This will cause all numerical resource type-IDs to be treated as user-type resources and will not be checked nor byte-reversed. Without this option, resources with, for example, type-ID 2 are parsed as bitmaps and other type-IDs will map onto their respective standard type. Use this option with caution because it can create problems when compiling for, for example, big-endian platforms. The -m option is usefull for source-files that contain overlapping type-IDs, or when the format of the resource is not 100% compliant.

-n  Do not generate an assembly outputfile (suppress generation of .s file). Usefull if you are interested in a header file only.

-N  Do not preprocess the input. This will most certainly result in compilation failure, unless you have preprocessed the source with another preprocessor before passing it to wrc.

-o file
    Write output to file. Default is inputfile.{res,s,h} with .rc stripped or wrc.tab.{s,h,res}, depending on the compilation mode.

-p prefix
    Prefix all generated names with prefix. This is only relevant for names in the assembly code and header file. Resource names are not affected.

-r  Create binary .res file (compile only).

-s  Add structure with win32/16 (PE/NE) resource directory to outputfile. This directory is always in native byteorder.

-t  Obsolete; generate indirect loadable resource tables.

-T  Obsolete; generate only indirect loadable resources tables.

-V  Print version end exit.

-w 16|32
    Select win16 or win32 output. Default is win32.

-W  Enable pedantic warnings. Notably redefinition of #define statements can be discovered with this option.

PREPROCESSOR
The preprocessor is ANSI-C compatible with some extensions of the gcc preprocessor.

The preprocessor recognizes these directives: #include, #define (both simple and macro), #undef, #if, #ifdef, #ifndef, #elif, #else, #endif, #error, #warning, #line, # (both null- and line-directive), #pragma (ignored), #ident (ignored).

The preprocessor default sets several defines:
RC_INVOKED set to 1
__WRC__ Major version of wrc
__WRC_MINOR__ Minor version of wrc
__WRC_MICRO__ Patch level
__WRC_PATCH__ Same as __WRC_MICRO__

Win32 compilation mode also sets __WIN32__ to 1 and __FLAT__ to 1.

Special macros __FILE__, __LINE__, __TIME__ and __DATE__ are also recognized and expand to their respective equivalent.

ERROR REPORTING
All errors and warnings are written to standard error and report:
filename:line-number:character-pos:{Error,Warning}:<message>
The character-position is always at the next token. I.e. the error or warning happened before. The line-number suffers from the same problem if the error occurred at the last token of the previous line. The line-number will be several lines off when the error was followed by several empry lines. See also BUGS.

AUTHORS
wrc was written by Bertho A. Stultiens and is a nearly complete rewrite of the first wine resource compiler (1994) by Martin von Loewis. Additional resource-types were contributed Ulrich Czekalla and Albert den Haan. Bugfixes have been contributed by many wine developpers.

BUGS
- The preprocessor recognizes variable argument macros, but does not expanded them correctly
- Error reporting should be more to the point (and verbose)
- Codepage/UNICODE translations are not/not correct implemented
- Default memory options should differ between win16 and win32.

There is no support for:
- RT_DLGINCLUDE, RT_VXD, RT_PLUGPLAY and RT_HTML (unknown format)
- PUSHBOX control is unsupported due to lack of original functionality.

Fonts are parsed and generated, but there is no support for the generation of the FONTDIR yet. The user must supply the FONTDIR resource in the source to match the FONT resources.

See the CHANGES and README.wrc files in the distribution for more comments on bugs and fixes across the versions.

AVAILABILITY
wrc is part of the wine distribution, which is available through WineHQ, the wine development headquarters, at http://www.winehq.com/.

SEE ALSO
wine(1),