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

  • SEARCH
  • Home
  • 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 6911453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:57:28+00:00 2026-05-27T08:57:28+00:00

My app is compiled with Delphi 2010. That app loads a Delphi 7 compiled

  • 0

My app is compiled with Delphi 2010. That app loads a Delphi 7 compiled DLL which loads a Delphi 2010 compiled DLL.

D2010 app LOADS D7 DLL LOADS D2010 DLL

The exported functions of the D7 DLL uses Widestrings and the exported functions of the Delphi 2010 DLL use strings.

As we all know, strings in Delphi 2010 are Unicode (2 bytes) and in Delphi 7 they are Ansi (1 byte).

All my tests show me that it is working despite the fact that it should not. I am wondering:

Why is it working?

What can go wrong?

Which memory manager should I use (Delphi 2010 or Delphi 7 memory manager DLL)

  • 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-05-27T08:57:29+00:00Added an answer on May 27, 2026 at 8:57 am

    In D2009 and D2010, the RTL has logic in place (the compiler’s {$STRINGCHECKS ON} directive) that allows an AnsiString to receive a Unicode payload, and a UnicodeString to receive an Ansi payload, across module boundaries, and then to perform a silent inline data conversion to the correct string type when the AnsiString/UnicodeString data is accessed. This is primarily to support legacy C++ projects that use event handlers with AnsiString parameters on the C++ side and UnicodeString variables on the Delphi side. In this case, it could also allow the D7 DLL to pass Ansi data to the D2010 DLL (the STRINGCHECKS directive was removed in XE, though).

    I would expect the D2010 DLL to fail, though, because the memory layout of a StrRec record (which preceeds the character data in memory) changed in D2009 to add support for codepages, so the D7 DLL would not be allocating a D2010-compatible StrRec when passing an AnsiString value to a UnicodeString parameter in the D2010 DLL. I would expect the D2010 DLL to crash when it tries to access/free memory that does not exist.

    This is yet another argument against ever passing String types across DLL boundaries. Just don’t do it, ever. Use WideString or PAnsiChar/PWideChar instead.

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

Sidebar

Related Questions

I have an app that is run from a compiled DLL on a web
I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces
I have a Delphi DLL that I did not write, but need to call
My Delphi app has created a squence called frame_001.png to frame_100.png. I need that
I'm writing delphi app which should have capability of loading plugins. I'm using JvPluginManager
I have made a app which uses visual studio's app.config to store settings about
Can a WinForms app compiled for Any CPU be configured to run as x86
I'm trying to install an ad hoc-provisioned iPhone app compiled under the 3.1.2 SDK
Just wondering if a .NET app can be compiled down to native machine code
I have compiled a simple win32 app successfully with bc++ (2 lines excerpt only):

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.