[Aldor-l] different libraries that contain files with same name
Christian Aistleitner
tmgisi at gmx.at
Thu Nov 29 03:24:41 EST 2007
Hello,
On Wed, 28 Nov 2007 18:15:41 +0100, Laurentiu Dragan <ldragan at aldor.org>
wrote:
> Ralf Hemmecke wrote:
>> 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.
I haven't ever come across source code from companies, which used a prefix
in _filenames_ to get differently _named_ object files.
Can you name an example of such a source code? Or is this this just a
noble wish?
> 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?
You are comparing apples to oranges.
From a language user point of view, it's filenames for Aldor but functions
in C.
But coming back to your question, yes (at least for ELF files) you can use
both foos from within one file.
Assume I have liba.a and libb.b. Both libraries contain an object file
exporting a symbol "foo", referring to "void foo(void) { something; }". I
want to write demo.c which can use both "foo"s. I suppose there are easier
ways, but at least the following works:
All that's required is a C-file (I'll call it libbwrapper.c) that contains
something like
void foo_from_libb( void )
{
foo();
}
Compile this file and link against libb.a. Afterwards localize the symbol
"foo" withit the ELF file (e.g.: by objcopy)
Then you can write your demo.c using foo for liba's foo and foo_from_libb
for libb's foo after linking demo.c with both liba and libbwrapper.o.
But for Aldor you do not get easy access to all the C files used during
compilation,...
Kind regards,
Christian
More information about the Aldor-l
mailing list