PByte

Top  Previous  Next

What is translated > Types > API Integration > PByte

PByte is an example for the API integration. PByte is defined in Winapi,Windows.pas as:

 

  PByte = System.Types.PByte;

 

 

and in System.Types.pas it is defined as:

 

  PByte = System.PByte;

  {$EXTERNALSYM PByte}

 

In System.pas it is defined as:

 

  PByte         = ^Byte;        {NODEFINE PByte}       { defined in sysmac.h }

 

 

Here the NODEFINE directive applies. For C++Builder PByte is defined in symac.h as

 

    typedef Byte*                PByte;

 

 

For other compilers than C++Builder the definitions are incongruent. The definition in Winapi.Windows.pas becomes in C++ to:

 

namespace Winapi {

namespace Windows {

 

typedef System::Types::PByte PByte;

 

But the automated translation would ignore the EXTERNALSYM in System.Types.pas. Therefore this definition is inserted manually into System.Types.h,

 

typedef System::PByte PByte;

 

 

In System.h, the definition has to exist:

 

 

typedef unsigned char* PByte;

 

 

Indeed the last definition is inserted two times in System.h: one time inside of the namespace System and one time in the global namespace. The latter definition is needed, because it is recommended to suppress namespaces for API headers. When the namespace "Winapi.Windows" is ignored, PByte has to exist

 

 

Remark:

 

FFor C++Builder Winapi.Windows.hpp defines:

 

using System::PByte;

 

 

But an explicit reference to System::Types::PByte then fails.

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content