Chau Chee Yang
Chau Chee Yang

Reputation: 19620

Include file behave differently using RC.EXE or BRCC32.EXE to build *.rc files

I wish to using dot (.) as resource entry in RC files for my Delphi project. However, Delphi's BRCC32.exe doesn't allow dot (.) in resource naming. Since Delphi 2010, we may specify "Resource Compiler to use" in

Project | Option | Resource Compiler 

to switch to RC.exe (Windows SDK Resource Compiler) that support dot in naming.

Using RC.exe as resource compiler works for dot naming I want. However, I encounter a problem using #include in the rc file.

I have a app.db.excludes.rc file is as follow:

#include "../../../../core/resource/db/excludes/system.db.excludes.rc"

HR_BRANCH_DSC     8000  "HR.BRANCH.DSC.xml"
HR_CALENDAR_DSC   8000  "HR.CALENDAR.DSC.xml"
HR_CATEGORY_DSC   8000  "HR.CATEGORY.DSC.xml"

And system.db.excludes.rc file:

#include "../../system.h"

SYSTEM_GROUPS_DSC   8000  "SYSTEM.GROUPS.DSC.xml"
SYSTEM_SCRIPT_DSC   8000  "SYSTEM.SCRIPT.DSC.xml"
SYSTEM_USER_DSC     8000  "SYSTEM.USER.DSC.xml"

Compile the Delphi project yields:

[BRCC32 Error] payroll.db.excludes.rc(3): file not found: SYSTEM.GROUPS.DSC.xml
[BRCC32 Error] payroll.db.excludes.rc(4): file not found: SYSTEM.SCRIPT.DSC.xml
[BRCC32 Error] payroll.db.excludes.rc(5): file not found: SYSTEM.USER.DSC.xml

The above problem occurs if using RC.exe. It works without any problems if I use BRCC32.exe.

This problem is due to both app.db.excludes.rc and system.db.excludes.rc isn't keep in same folder.

If I change system.db.excludes.rc to

#include "../../system.h"

SYSTEM_GROUPS_DSC   8000  "../../../../core/resource/db/excludes/SYSTEM.GROUPS.DSC.xml"
SYSTEM_SCRIPT_DSC   8000  "../../../../core/resource/db/excludes/SYSTEM.SCRIPT.DSC.xml"
SYSTEM_USER_DSC     8000  "../../../../core/resource/db/excludes/SYSTEM.USER.DSC.xml"

The RC.exe will then compile successfully.

Does anyone has any ideas how to make RC.exe works as BRCC32.EXE when interpret the include files as above?

Upvotes: 3

Views: 2201

Answers (2)

Chau Chee Yang
Chau Chee Yang

Reputation: 19620

Instead of using #include to embed a rc file:

#include "../../../../core/resource/db/excludes/system.db.excludes.rc"

I remove the usage of #include and add "system.db.excludes.rc" into my Delphi project (.dproj).

The patched "app.db.excludes.rc" is:

HR_BRANCH_DSC     8000  "HR.BRANCH.DSC.xml"
HR_CALENDAR_DSC   8000  "HR.CALENDAR.DSC.xml"
HR_CATEGORY_DSC   8000  "HR.CATEGORY.DSC.xml"

And my Delphi package file (.dpk) is as follow:

package resource.db;

{$R *.res}
{$R 'payroll.db.excludes.res'}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
....

A resource entry should added to the .dpk file manually:

{$R 'payroll.db.excludes.res'}

This approach works for both BRCC32.exe and CGRC.exe / RC.exe.

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613013

You could try the /I option of RC to specify the directory in which your XML files live. You'd have to run RC as a pre-build action in order to get that much control over its execution environment.

Upvotes: 3

Related Questions