[Aldor-l] different libraries that contain files with same name
Laurentiu Dragan
ldragan at aldor.org
Wed Nov 28 12:15:41 EST 2007
Ralf Hemmecke wrote:
> On 11/27/2007 09:05 PM, Laurentiu Dragan wrote:
>> Ralf Hemmecke wrote:
>>> Hello,
>>>
>>> maybe all of you know, but I would really like to know why there is
>>> this restriction that I cannot have two libraries that contain the
>>> same filename. Why does the file name in different object libraries
>>> matter at all?
>>
>> The restriction is in the way Aldor treats libraries. In Aldor, .al
>> files are collections of "libraries". For example, libaldor.al
>> contains sal_lang.ao library, sal_base.ao library, and others. Each
>> such library has an
> > initialization function which is identified by name
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> No problem.
>
>> and the name is built from the name of the file.
>
> Why is that? Is there a need to do it that way or can it also be done
> otherwise without knowledge of the filename?
>
> Do you see a way of getting away with that restriction?
It seems that this behavior is used in many places, so any change would
require non trivial modifications to the compiler.
>
>> So, you cannot have two "Aldor libraries" with the same name and use
>> them at the same time, even if they are in different .al or .a file.
>
> It's hypothetical, but imagine you buy a big aldor library from one
> company and another one from another company.
> Both work on non-intersecting areas and have no domain in common.
> You have written a big program that uses both of these libraries.
> Now, for some reason, one company renames a file to foo.ao so that
> (accidently) it agrees with the name of a file in the other library.
> What would you do if you realize that you've spent lots of money to
> develop your program, lots of money for the two libraries and now you
> cannot use both libraries to build the program you want?
>
> Even in an opensource development model that is an unacceptable
> restriction.
That's why companies should use some sort of prefix. If they have the
same prefix, then the libraries are incompatible.
What if I write two functions "foo" in C and put each one in a different
library. Can you use both functions from the same C source file?
>
>>> Any suggestion for a workaround?
>
>> Yes, change the name of the file :) (use a prefix for files that are
>> supposed to be used in a library, see sal_* or sit_*)!
>
> OK do it for these closed-source libraries, I mentioned above. ;-)
>
> Any better solution?
Implement packages or other way of separating names.
--
Laurentiu
More information about the Aldor-l
mailing list