Delphi XE3: What are the new types, MarshaledString and MarshaledAString used for?
Asked Answered
A

2

6

In Winapi.Windows.pas of Delphi XE3, many C types that were formerly defined as PWideChar and PAnsiChar now are defined as MarshaledString and MarshaledAString respectively (e.g. PWChar, LPSTR):

  PWChar = MarshaledString;
  LPSTR  = MarshaledAString;

Indeed, in System.pas, MarshaledString and MarshaledAString are equivalent to PWideChar and PAnsiChar respectively,

  MarshaledString  = PWideChar;
  MarshaledAString = PAnsiChar;

but what is the background behind this decision? I mean, why Embarcadero should redefine such C string types?

Apologia answered 12/11, 2012 at 21:12 Comment(0)
T
4

Embarcadero is working on a next-generation compiler for mobile development. The changes you see are related to that effort. The technical details are not public yet, so nobody with info about it is allowed to say anything further about it.

Tails answered 13/11, 2012 at 0:56 Comment(2)
Ooooh! A foreshadowing of things to come!Fiester
Is that for RAD Studio Mobile? Looking forward to that one.Alcheringa
O
0

From official documentation:

System.MarshaledString is an alias for PChar.
System.MarshaledAString is an alias for PAnsiChar.

MarshaledString is meant to be used on mobile platform to keep with the notion of eliminating pointers and looking forward, the new Delphi Next-Generation Mobile Compiler requires a more explicit style of marshalling data to/from external APIs and libraries.

Obsequent answered 9/5, 2022 at 16:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.