[fpc-pascal] A patched unit overriding the default - like Delphi supports

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jun 17 11:57:58 CEST 2010


Op 2010-06-17 11:13, Mattias Gaertner het geskryf:
> 
> If only the unit implementation changes, and you don't use inlines and
> you compile the unit with the same compiler flags, can this ppu be used
> instead of the original?

So far so good.  I managed to successfully replace ibconnection.pas which
is part of the fcl-db code.

All I had to do, was copy the ibconnection.pp to the /tmp/fixes directory
and apply the fixes/change there. Add /tmp/fixes as the first Unit Path in
the Lazarus Package that uses fcl-db.  The Lazarus Packages was set to
"automatically rebuild as needed". After a lazarus package recompile, a new
ibconnection.[o|ppu] was created in the lazarus package output directory
(lib/x86_64-linux/). When I then recompiled my project that uses that
lazarus package, it too was linked with the newer ibconnection and I could
see the changed behaviour in my application when run.

I also tried adding -Fu/tmp/fixes/ in the ~/.fpc.cfg but for some reason
that did not make any difference. The units in /tmp/fixes was not
recompiled. I had to add the new path in the Lazarus Package (*.lpk) or
project itself.


NOTE:
I haven't attempted to modifying a *.inc file yet, only a *.pas or *.pp
that doesn't contain include lines.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list