I tried sending this message two days ago, but it seems not to have gone through. Trying again.

I like using include files, to break up big units into multiple files, and also as macro-based templates.

One thing I do frequently is to put both the interface and the implementation into one include file, and include it twice-- once in the interface, and once in the implementation section of the unit. The include file thus looks like this:

{$ifdef interface}
  <type declarations>
{$endif}

{$ifdef implementation}
  <code>
{$endif}


So my question-- right now I have to manually define and undefine the symbols "interface" and "implementation" in each unit.

Is there a way to detect what section of a unit the compiler is in, rather than using these user-defined symbols?

So in my include file(s), instead of writing {$ifdef interface} I would write something that actually knows if an interface or implementation is being compiled.

Ditto for initialization, finalization (although I use this much less frequently)

Thanks!

~David.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to