Re: How to include the header files effectively

2019-04-11 Thread Michael Paquier
On Thu, Apr 11, 2019 at 10:22:56PM -0400, Alvaro Herrera wrote: > What are you trying to do? Your .c file must include "postgres.h" > before any other header file. There should be no other dependencies. The usual rule when it comes to develop extensions or a patch is to include headers in the fo

Re: How to include the header files effectively

2019-04-11 Thread Alvaro Herrera
On 2019-Apr-12, Andy Fan wrote: > for example, when I want the LOCKTAG in .c file, which is defined in > "storage/lock.h". then I wrote the code like this: > > #include "storage/lock.h" > ... > > /../../../src/include/storage/lockdefs.h:50:2: error: unknown type name > 'TransactionId'

Re: How to include the header files effectively

2019-04-11 Thread Tom Lane
Andy Fan writes: > for example, when I want the LOCKTAG in .c file, which is defined in > "storage/lock.h". then I wrote the code like this: > #include "storage/lock.h" > ... > LOCKTAG tag; > compile and get errors. > In file included from > .../src/include/storage/lock.h:21: > /../../../sr

How to include the header files effectively

2019-04-11 Thread Andy Fan
I find the dependency is complex among header files in PG. At the same time, I find the existing code still can use the header file very cleanly/alphabetically. so I probably missed some knowledge here. for example, when I want the LOCKTAG in .c file, which is defined in "storage/lock.h".