Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:27:40+00:00 2026-06-03T17:27:40+00:00

To help us modularize a monolithic application, we are in the process of setting

  • 0

To help us modularize a monolithic application, we are in the process of setting up packages for use in debug builds, while still compiling to a single exe for release builds.

One of our packages (EAUtils) contains a unit that is now producing [DCC Error] E2201 Need imported data reference ($G) to access 'SMsgDlgWarning' from unit 'SystemUtils'.

This happens when building the EAUtils package itself. I am not into building packages that depend on EAUtils yet. EAUtils only depends on rtl/vcl packages and a package I created for the Jedi WinApi units.

This is a result of the lines:

// This is a TaskDialog override, with the same args as the old MessageDlg.
function TaskDialog(const aContent: string; const Icon: HICON = 0; 
  const Buttons: TTaskDialogCommonButtonFlags = TDCBF_OK_BUTTON): Integer;
const
  Captions: array[TMsgDlgType] of Pointer = (@SMsgDlgWarning, @SMsgDlgError, @SMsgDlgInformation, @SMsgDlgConfirm, nil);
var
  aMsgDlgType: TMsgDlgType;
  aTitle: string;
begin
  aMsgDlgType := TaskDialogIconToMsgDlgType(Icon);
  if aMsgDlgType <> mtCustom then
    aTitle := LoadResString(Captions[aMsgDlgType])
  else
    aTitle := Application.Title;

More specifically this is a result of referencing SMsgDlgWarning, SMsgDlgError, SMsgDlgInformation and SMsgDlgConfirm, which are all declared in Vcl.Const.

Please note that this code compiles without error when we are building a single executable.

As a means of optimization, our include file does contain {$IMPORTEDDATA OFF} as this allows for faster access to (global) variables and constants. See http://hallvards.blogspot.com/2006/09/hack13-access-globals-faster.html.

According to the documentation on the error ( http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/cm_package_varref_xml.html ) this is the cause and it says “To alleviate the problem, it is generally easiest to turn on the $IMPORTEDDATA switch and recompile the unit that produces the error.”

So, I have set {$IMPORTEDDATA ON} in our include file and made doubly sure by setting the Use imported data references to true in the Delphi Compiler | Compiling | Debugging section of the project options.

Unfortunately, contrary to the documentation, this did not alleviate the problem. Even setting this compiler directive directly above the offending code and rebuilding the package did not remove the errors.

What else do I need to do to solve this E2201 error?
Not sure, but it may be significant that SMsgDlgWarning and its friends are resource strings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:27:46+00:00Added an answer on June 3, 2026 at 5:27 pm

    The error message is, IMHO, misleading, it’s Vcl.Consts which has been compiled with $G- and that’s causing the problem.
    As a workaround, you can use something like this:

    function Captions(AType: TMsgDlgType): Pointer;
    begin
      Result := nil;
    
      case AType of
        TMsgDlgType.mtWarning:
          Result := @SMsgDlgWarning;
        TMsgDlgType.mtError:
          Result := @SMsgDlgError;
        TMsgDlgType.mtInformation:
          Result := @SMsgDlgInformation;
        TMsgDlgType.mtConfirmation:
          Result := @SMsgDlgConfirm;
      end;
    end;
    

    Using a const array of string compiles, too (although it breaks localization):

    const
      Captions: array[TMsgDlgType] of string = (SMsgDlgWarning, SMsgDlgError, SMsgDlgInformation, SMsgDlgConfirm, '');
    

    or you could build your own package containing Vcl.* units, with {$G+} and use that instead of the standard vcl package. I prefer the first solution; the latter can potentially create more problems later with deployment (so-called “DLL hell”).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help! I am absolutely clueless on this. I've been told that the web application
Within the OO paradigm, we choose to use classes because they help us to
Help. I need to know if you can change the relationship status (Married, Single,
HELP! I need help setting up tipsy I had it working earlier but now
Help! I'm using the ASP.Net Login control on a Login page, but the Login
Help, I'm trying to create a new post in my wordpress blog with custom
Help, I can't function without Resharper . All of a sudden my Alt +
Help with regular expressions needed. I'm trying using regular expressions and preg_match_all find blocks
help out a noob with a simple web development question?? I want to create
Help. TCHAR* b; TCHAR* c=TEXT(qwerty); I want to allocate memory and copy content of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.