[fpc-pascal]Forward type declaration
peter at freepascal.org
Wed Apr 23 21:55:05 CEST 2003
> Currently I'm translating libusb for FPC. Therefore I used "h2pas".
> libusb has two types called usb_device and usb_bus. Both are records.
> Each of them has fields, which have ^usb_device and ^usb_bus as types.
> So there is a cross type reference between these two records.
> In C they simply build a forward type declaration ("struct usb_device;
> struct usb_bus;"). In FPC unfortunately this is not possible. Is this
> Are there any plans to add forward type declarations?
It is already possible.
You need to define a pointer type to the record first. See the example for
a linked list:
PRec = ^TRec
TRec = record
next : PRec;
More information about the fpc-pascal