Einzelnen Beitrag anzeigen

RPRI

Registriert seit: 11. Feb 2003
Ort: A-6710 Nenzing
24 Beiträge
 
#1

Problem mit Pointer in Strukturen

  Alt 24. Jan 2011, 09:51
Delphi-Version: 5
Hallo zusammen,

ich habe ein Problem mit einem Pointer in einer Struktur.
Da ich nicht so ganz fit bin mit Pointern, hoffe ich auf Eure Hilfe.

Muß Funktionen aus einer C.dll ausführen.

Hier der Code:
Delphi-Quellcode:
    {* @brief Holds the name of a module}
    MODULE_NAME = RECORD
       name : ARRAY[0..M_MODNAMELEN_A] OF CHAR;    // Name of the module.
    END;
    {* @brief Structure for a list of module names.}
    MODULE_LIST = RECORD
       countModules   : UINT16;             // Count of module names.
       names      : ^MODULE_NAME;          // Array of module names.
    END;
    PMODULE_LIST = ^MODULE_LIST;


FUNCTION TARGET_GetModules ( targetHandle : M1C_H_TARGET; moduleCount : UINT16; moduleList : PMODULE_LIST ) : SINT32; cdecl; external 'm1com.dll';


#################################
Hier die Verwendung:
VAR
  countModules : UINT16;
  RetCode : SINT32;
  i : UINT16;
  modList : MODULE_LIST;
  names : ARRAY[0..MaxSwModules] OF MODULE_NAME;

BEGIN
  // Set the ModuleList
  modList.names := @names;

  //asking the count of modules on the controller
  RetCode := TARGET_GetCountModules ( targetHandle, @countModules );
  IF ( RetCode = M1C_OK ) THEN RetCode := TARGET_GetModules ( targetHandle, countModules, @modList );
    IF ( RetCode = M1C_OK ) THEN
      BEGIN
        // clear the list
        FOR i := 0 TO MaxSwModules DO SWModList[i] := '';
        // filling the List
        FOR i := 0 TO ( countModules - 1 ) DO
          SWModList[i] := modList.names[i].name; <- hier mosert er beim compilieren.
.......
Danke schon mal für Eure Hilfe!

Gruß
Rainer
Holm und Rippe,
bis zur Kippe !

Rainer

http://members.aon.at/p-51
  Mit Zitat antworten Zitat