fbfrog
fbfrog copied to clipboard
Automatic forward declarations?
Currently, fbfrog ignores forward struct declarations by default, if no definition of the struct appears later:
struct Typ;
extern Typ *x;
translates to
extern x as Typ ptr
whereas if struct Typ {int a;};
appears later you get
type Typ as Typ_
extern x as Typ ptr
type Typ_
a as long
end type
Without the definition, adding -addforwarddecl Type
is necessary to get a working translation.
Why not add a forward declaration automatically if there is a C declaration but no definition; is it not desirable for some reason, or is it simply not implemented? The only reason to avoid doing so that I can think of is if there's another header that fbfrog wasn't given which will have already defined it. But that would be the exception, not the norm, accommodated with a -noforwarddecl
option.