dear friends,
I know that if want to use an external variable/procedure in fpc, i
should use the following code:
function GetEnvironment (const Name: PChar): PChar; cdecl; external 'c'
name 'getenv';
but how could i add for example GetEnvironment function to a class
(TEnvironment)!
Is there any good (OO) way?
Is it a good idea to use a following method:
TGetEnvironmentFunction= function : PChar;
TEnvironment= class (TObject)
private
...
public
GetEnvironment: TGetEnvironment;
procedure SetGetEnvironmentFunction (AFunction: TGetEnvironmentFunction);
...
end;
procedure TEnvironment.SetGetEnvironmentFunction (AFunction:
TGetEnvironmentFunction);
begin
GetEnvironment:= AFunction;
end;
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel