LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Linking question

[ILUG] Linking question

hmoreau at digiserve.ie hmoreau at digiserve.ie
Tue Nov 7 15:21:37 GMT 2000


On  7 Nov, Mel wrote:

> They are two static libs that are part of an SDK for music
> encoding/decoding. At some stage both of them have similar functions such
> as frame counters and global constants. I can strip out some of the
> functions but not all of them. I was hoping there was some way you could
> tell the linker thant when there is duplicate symbols, just take them from
> the first library
> 
> not looking like it though.
> 

/* If you have a c file like this (one.c):- */

char *something;

int afunction (int v)
{
    something = malloc(v);
}

/* and another c file (two.c) :- */

int something;

int bfunction ()
{
   something = 10;
}

These two files are compiled into separate libraries.  How could the
linker make up its mind as to which declaration of something is the one
to use?  If your libraries contain extern/global data with the same
name(s) then they can't be used together. Even if the names and types
were the same (as in C++ with name mangling), and linking was possible,
there would be a strong likelihood that strange things would happen.
-- 
--harry





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell