On 25 Aug 2010, at 09:00, dmitry boyarintsev wrote:

Is it expected behavior, that explicitly set library name is not used
in linking for Drawin target (fpc 2.5.1)?

function SomeFunc: Integer; external 'LibName';

The log entry for the removal of that functionality was this:

revision 1.16
date: 2004-06-02 09:03:49 +0200; author: jonas; state: Exp; lines: +11 -3; - disabled automatic adding of libraries from "external lib name 'xxx'"
    for now (until we have proper framework support)

The problem was (and actually still is) that many of those units can be used either in combination with a library or with a framework. In one case you need {$linklib LibName}, in the other case {$linkframework LibName}. If you don't want to force one or the other on the program using the unit (and if you don't want to create two ppu files for every import unit), then deciding which library/framework to use should be left to the main program. Rather than adding {$ifndef darwin}'s around every declaration's external library name, I decided that simply ignoring those library names for Darwin would be better.

Now, in many cases we added {$linklib LibName} for Darwin to the units anyway so in practice it doesn't make that much of a difference. I guess in some cases we use {$linkframework xxx} instead though. We could add a switch to decide that the external library names should be interpreted as framework names instead, since I guess in most units everything is either in a library or in a framework (rather than in a mixture of libraries and frameworks).

I don't know what the best solution is.


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

Reply via email to