Einzelnen Beitrag anzeigen

Benutzerbild von duff
duff

Registriert seit: 26. Jan 2005
Ort: Brühl
76 Beiträge
 
Delphi 2007 Professional
 
#1

cpp to delphi struct Problem

  Alt 15. Sep 2006, 14:54
Hallo Leute,

ich habe ein Problem mit folgender cpp Struktur:

Code:
typedef struct
{
  LONG            nSize;                            // size of the struct
  TCHAR           sCountry[MAXLEN_COUNTRY];         // country
  TCHAR           sCity[MAXLEN_CITY];               // city
  TCHAR           sZipCode[MAXLEN_ZIPCODE];         // postal code
  TCHAR           sStreet[MAXLEN_STREET];           // street
  TCHAR           sHouseNumber[MAXLEN_HOUSENUMBER]; // housenumber
  float           fX;                               // x position
  float           fY;                               // y position
  NCK_COORD_FORMAT coordFormat;                      // format 0:WGS84, 1:Gauss-Krueger
  NCKErrorStatus  errStatus;                        // error status in case of conversion
} NCKTarget;
Code:
#define MAXLEN_COUNTRY          10    // country
#define MAXLEN_CITY            100    // city
#define MAXLEN_ZIPCODE          20    // postal code
#define MAXLEN_STREET          100    // street
#define MAXLEN_HOUSENUMBER      20    // housenumber
#define MAXLEN_MESSAGE         128    // message for status
#define MAXLEN_GPSSTRING       256    // GPS string
Meine Delphi Übersetzung

Delphi-Quellcode:
type
  TNCKTarget = record
    nSize: integer; // size of the struct
    sCountry: array[0..9] of char; // country
    sCity: array[0..99] of char; // city
    sZipCode: array [0..19] of char; // postal code
    sStreet: array[0..99] of char; // street
    sHouseNumber: array[0..19] of char; // housenumber
    fX: single; // x position
    fY: single; // y position
    coordFormat: NCK_COORD_FORMAT; // format 0:WGS84, 1:Gauss-Krueger
    errStatus: TNCKErrorStatus; // error status in case of conversion
  end;
Nun ist es so, dass in der cpp Anwendung das Struct 400 Bytes hat und die Delphiversion 396 Bytes. Was mache ich falsch? Liegt es vielleicht an den Aufzählungstypen?? Wäre schön wenn jemand helfen könnte!!

Delphi-Quellcode:
type
  NCK_COORD_FORMAT = (COORD_FORMAT_WGS84 = 0, COORD_FORMAT_GK = 1);
Code:
enum NCK_COORD_FORMAT
{
   COORD_FORMAT_WGS84 = 0,
   COORD_FORMAT_GK
};


Delphi-Quellcode:
type
  NCK_ERROR_CODE = (NCKERR_OK = 0, NCKERR_CONVERT_COORD_TO_ADDRESS = 1,
    NCKERR_CONVERT_ADDRESS_TO_COORD = 3);
Code:
enum NCK_ERROR_CODE
{
   NCKERR_OK = 0,
   NCKERR_CONVERT_COORD_TO_ADDRESS,
   NCKERR_CONVERT_ADDRESS_TO_COORD
};
  Mit Zitat antworten Zitat