Op Mon, 17 Jul 2006, schreef Jonas Maebe:
> On 17 Jul 2006, at 14:03, Daniël Mantione wrote:
>
> > > There's nothing C-specific about libraries, nor about the *config
> > > scripts. At
> > > most it would be linker-specific.
> >
> > There is, those scripts mainly exist because a C compiler cannot
> > determine
> > the dependencies of a library. I.e. if you like libgtk you must also link
> > libglib.
> >
> > We don't need this in Pascal, the compiler can perfectly determine the
> > dependencies by checking the used units. So the primary reason for this
> > cruft is void in Pascal.
>
> You could support exactly the same in C with some #pragma statements in the
> header files. This is implementation-specific rather than language specific.
In that case, there exists no need for gtk-config at all.
> > > A library also exist in at least multiple locations, versions (both
> > > ABI-compatible and -incompatible with previous versions) and
> > > implementations
> > > (e.g. a native Mac OS X GTK and an X-based one).
> >
> > I don't see how *_config guards you against this:
> > * In case of a version change it will simply return the new version. The
> > .so symlink does this as well. If the new version is incompatible with
> > the old one, bad luck.
>
> But if the new version has additional (or different) dependencies or library
> names, everything will remain fine with the script (as e.g. with the FreeBSD
> problem which started this discussion).
That is exactly what Marco's code solves, in a generic way. Solving it by
parsing gtk-config, tclConfig.sh, and so on is a work that never finishes.
> It's the same with different
> implementations which maybe be ABI- and API-compatible, but have different
> dependencies.
Solve it using Pascal:
{$ifdef platform}
uses library;
{$endif}
.... and the compiler will sort out the rest.
> > It helps for locations, but we already have a well adequate solution for
> > that: Putting the location in fpc.cfg.
>
> Of course you can require the user to manually specify everything in his
> config file or on the command line, but it's nicer if this can be avoided.
If there was a generic way determining library locations: yes
gtk-config can only be used to determine the location of one
library: libgtk. It is useless for libtcl, for example.
Still, you can put some autodetections in samplecfg, but the compiler
itself is really the wrong location to do so.
Daniël
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel