Delphi 2010: Some of resourcestrings defined in.rc file are missing in resulting .exe

635 Views Asked by At

Some of resources from .RC file are not available in resulting .exe with the ID's given in .RC file. I have and RC file with resourcestrings with id's 10000, 10100 etc. At some reason, when I load resource with id 10000 (LoadStr(10000)) it loads another string ('Invalid field type.' - which is declared in midas.rc from VCL and has the same id).

I assumed that resources with the same id should lead to "[Error] WARNING. Duplicate resource(s)" during the build. But there is no linker-related warnings.

p.s. I'm using Delphi 2010.

Update:

  • Workaround on that issue is to change id from 10000 to something else. 10050, e.g.

Question:

  • Why there's no warnings on duplicate resources?
  • What could be done to prevent that problem in future?

myproject.inc

const
  offLanguages   = 10000;
  offCurrencies  = 10100;

myproject.RC file

LANGUAGE LANG_LATVIAN, SUBLANG_NEUTRAL

#include "myproject.inc"

STRINGTABLE
{
 offLanguages+0, "LV"
}

.. etc...

Rc file is compiled to myproject.res file. And the resulting .res files has correct string "LV" with ID 10000 (I checked that with resource editor).

In delphi coude resources are loaded in unit's initialization part, using LoadStr function.

likeThat.pas:

unit likeThat;

interface

{$I *.inc}
{$R *.res}

// skipped

initialization
  Assert(LoadStr( offLanguages )= 'LV'); // <== fails here
0

There are 0 best solutions below