This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "AR" problem


Ben,
Thank you for the reply.

>-----Original Message-----
>>From: Ben Elliston <bje@au1.ibm.com>
>>Sent: Dec 11, 2006 6:44 PM
>>To: Igor Korot <ikorot@earthlink.net>
>>Cc: binutils@sourceware.org
>>Subject: Re: "AR" problem
>>
>>On Mon, 2006-12-11 at 21:17 -0500, Igor Korot wrote:
>>
>>> Now, in my app I have 2 statically linked .a library. One library (mylib1.a) depends on the other (mylib2.a). I was planning to link them together in one library using the KDevelop. However to my surprise, I found that the "ar" utility, that is used to generate the .a file/library does not work if the file is not located in the current directory. It is saying: "File not found".
>>
>>It's up to you to decide what goes into each of your archive libraries.
>>If it makes sense to put all of the code into one library, then do that.
>
Problem is: I don't know how smart the linker is?
My situation is following: 
mylib1.a exports myclass1
mylib2.a exports myclass2

class2 is using some functions from class1.

At the same time I have a dynamically linked library "mydll.so", which has a class class3 declared as 

class class3 : public class2
{
};

At the same time the class3 is using the functionality that is presented in class1.

Since I'm doing cross-development, on Windows using Visual Studio I can link ylib1.dll and mylib2.dll in one library
and then link mylib1.dll and mylib2.dll to mydll.dll.

However, it looks like on Linux I am having problems doing so.

That's why I have all these questions.

>
>>If not, keep them separate.  When it comes time to link your final
>>application, include -lmylib1 -lmylib2 and link both to the final
>>executable.  If there is a dependence between the two, you'll need to
>>determine the order that they're linked.
>
When I did such thing, the application crashed. I tried to put -mylib1 first, and put it second.
No difference.
And what about my second question: looking for the different directory than the current?
Is it going to be supported?
>
>>
>>Cheers, Ben

Igor.

>>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]