Up until now, I have been exploring Lazarus via LABs and WORKSHOPS which explore a single capability of Lazarus. These programs have in common that they use a pretty common set of pre-existing Lazarus Units. Now, however, I want to take a cautious step into writing my own 'utility' unit.
It happens to be a Tracing unit, which allows a program to call a trace function with several possible conditions, and to geneerate a line in a trace file, containing the parameters passed to the trace function. Te unit contains the following capabilityies:
unit SDLTrace;
{$mode objfpc}{$H+}
interface
uses
Classes,
Variants
{ you can add units after this },
SDLFS01;
var
TraceFlag : boolean;
EVTraceFlag : boolean;
TraceLevel : integer;
//**********************************************************
//***
//*** SDL Standard Version identifiers
//***
//**********************************************************
Function GetVersionLine () : string;
Function GetVersionDate () : string;
Function GetCompileDate () : string;
Procedure TraceInit (TraceFileName : string; TraceStatus : var tSDLStatus);
Procedure TraceTerm ();
Procedure StopTrace (); { an alias for TraceTerm }
procedure PauseTrace ();
Procedure ResumeTrace (pTraceLevel as integer);
Procedure SDLTrace( parm1, parm2, parm3, parm4,
parm5, parm6, parm7, parm8 : variant);
{ Unconditional trace of the upto 8 parameter values}
Procedure TraceIf (pLevel, parm1, parm2, parm3,
parm4, parm5, parm6, parm7 : variant);
{ Conditional Trace - completes only if TraceLevel >= pLevel }
The tSDLStatus is referenced in Unit SDLFS01, but the compiler can't find this unit.
I know I have to tell the compiler where to find such units, but am at a loss to know how to do this!
Attempts:
1) IDE Options | Environment | Files
Nothing seems to match. Lots of directory references but none of them seem to bear the slightest resemblance to what I'm actually using! EG My 'default source' is
F:\Software Development\Lazarus Projects, and within that directory, I have another directory called SDLTrace. This is where the source above comes from, and it compiles (or rather it doesn't, but it gets as far as trying to compile before it gives up).
2) IDE Options | General
Nothing seems to match - certainly nothing that is tickling any part of my fancy!
3) IDE | Everything else
Fascinatingm but my eyes begin to glaze at the wealth of possibilities.
What I'm looking for is a configuration item like:
This is where Lazarus will look for the source of the units that you reference in a Uses command:
Here are my hopes for an end-state to my searching.
1) Lazarus will compile my unit (SDLTrace) and produce an object file that can be added into a DLL (No idea how, as yet)
2) When my unit (SDLTrace) is referenced, via a Uses statement, Lazarus will know where to look for it (see my earlier comment) and access that unit - bringing the text of the interface part (only) to the compilation of the client program or unit or whatever.
Many decades ago, I was an early user of UCSD Pascal (where, I think, the concept of Units was started), and my thinking is firmly based on that model. Which doesn't necessarily mean that it matches Lazarus.
Can someone either destroy (gently) my thinking, or pick me up and put me back on the path to programming nirvana?
Thanks,
Tony