3

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?

Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132
  • I wonder BRCC32 works... unless that's a matter of current directory –  Dec 27 '10 at 15:00

2 Answers2

3

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.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Speaking of controlling the execution environment, you might just be able to set the `INCLUDE` environment variable to mention the desired directory, and then you wouldn't need a special pre-build action anymore; the default execution of `rc` would work. – Rob Kennedy Dec 27 '10 at 16:05
0

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.

Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132