我有两种类型。一种 A 型和一种 B 型。问题 A 型包含 B 型,B 型包含 A 型。这样的事情是行不通的:
type
typeA = record
test1 : typeB;
end;
type
typeB = record
test2 : typeA;
end;
编辑: 那不是我的设计。我将包含此类结构的 C 头文件(以访问 DLL)转换为 delphi。
编辑 2: “C++ 结构是 AFAIR 类的另一个名称。而且必须有指针,而不是值本身。 – Arioch '1 分钟前”是的,你是对的,它是一个指向类型的指针:
我在那里定义:
test1 : ^typeB;
那会起作用吗?
test1 : Pointer;
Edit3: C结构:
/* DLPDFPAGE */
typedef struct dlpdfpage
{
CosObj Page;
CosObj PrintSelect;
ASFixedRect PageBBox;
ASFixedRect ContentBBox;
struct dlpdfpage *Next;
PDRotate Angle;
struct dlpdfdoc *Doc;
DLPDFSTREAM *Content;
long PageNumber;
char Complete;
char FontSubstituted;
char FontMM;
char FontBad;
} DLPDFPAGE;
/* DLPDFDOC */
typedef struct dlpdfdoc
{
DLPDFINSTANCE *dliInstance;
PDDoc pdDoc;
CosDoc cosDoc;
DLPDFOUTLINE *Outlines;
char *PDFFileName;
char *PDFPostFileName;
DLPOS LastPageEnd;
DLPOS BeforeDef;
ASFixedRect DocBBox;
long PageCount;
long PageTreeWidth;
long PageTreeDepth;
long PageTreeDepthUsed;
DLPDFPAGETREEARRAY *AllPages;
DLPDFFONTLIST *AllFonts;
DLPDFFORMLIST *AllForms;
DLPDFFORMLIST *AllColors;
DLPDFIMAGELIST *AllImages;
DLPDFSPOTCOLORLIST *AllSpotColors;
DLPDFSPOTCOLORLIST *AllPatterns;
DLPDFEXTGSTATELIST *AllExtGStates;
DLPDFPAGE *PageList;
DLPDFPAGE *LastPage;
DLPDFDEST *DeferedDests;
DLPDFSIGNATURE *signatureHolder;
struct dlpdfacroform *AcroFormBase;
CosObj PatternColorObj,
PatternColorRGBObj,
PatternColorCMYKObj,
PatternColorGrayObj,
PrintSelect,
PrintSelectCriteria;
CosObj IdentH, IdentV;
ASAtom DocumentEncoding;
long FontCount;
long FormCount;
long PatCount;
long ImageCount;
char Compress;
char Linearize;
char PageTreeComplete;
char EmbedFonts;
char PatternColorsDefined;
char MakeThumbNails;
ASBool psSevenBitSafe;
ASInt32 EncryptKeyByteCount;
char condenseResDicts;
CosObj resourceDict;
ASInt16 pdfMajorVer;
ASInt16 pdfMinorVer;
DLPDFINCLUDEDRES *InclRes;
DLPDFSPOTCOLORLIST *AllShadings;
long ShadeCount;
} DLPDFDOC;