Does 'ar' work with native MS Windows libs?

Coatimundi coatimundi@cox.net
Tue Oct 3 14:54:00 GMT 2006


Christopher Faylor wrote:
> On Tue, Oct 03, 2006 at 07:10:50AM -0700, Coatimundi wrote:
>> Christopher Faylor wrote:
>>> On Mon, Oct 02, 2006 at 07:27:50PM -0700, Coatimundi wrote:
>>>> I need to break open a library I created with Visual Studio and insert 
>>>> some objects also compiled with Visual Studio.
>>>>
>>>> Will Cygwin's ar command work for this task?
>>> Here's an idea: How about just *trying* it?
>>>
>> Well, that's a good idea.  I did that before posting and found different 
>> degrees of success with different libs.  Rather than potentially waste a 
>> lot of good people's time, I asked for and received a quick up/down 
>> indicator.  Thanks.
> 
> By not including the above information in your initial message and not
> expounding on what is meant by "different degrees of success" you have
> ended up not getting informed responses.
> 
> 'ar' should operate on .lib files correctly.  If you have specific
> problems then providing details would help you get non-speculative
> responses.
> 
> cgf
> 

Thanks for your offer.  I've received several replies (mostly not to the 
list).  Your second post in this thread is the first indication that 
'ar' should work for lib files.  This is an encouraging development.

The particulars may depend on code which I cannot distribute.  I hope 
that is not the case, but I can try to cook up a clean example if 
needed.  First, I should note that I just installed Cygwin on this box, 
which happens to be an Opteron, so 'ar' should be up to date.

The thing I noticed first was that 'ar vt libfoo.a' did not always list 
all of the member names.  Some were present, some were missing. 
(Linking with the lib unambiguously confirms that they're all there. 
The total number of routines is about 20 in this small lib.)  So far I 
have seen this effect only with libs compiled with debugging 
information.  I have not noticed this problem with libs compiled without 
debugging info.  This observation is anecdotal but enough to make me wonder.

So I decided to extract a single object from the (non-debug-info) 
libfoo.a with both Cygwin's ar and Microsoft's LIB.EXE.  The resulting 
objects differed in byte-count, which I took (perhaps wrongly) as a 
strong clue that I was headed in the wrong direction.

I suppose it's possible that the format for individual objects might be 
tool-dependent as long as each tool generates the same archive format. 
So perhaps a better test would be to disassemble lib.a with one tool and 
reassemble it with the other tool.

I appreciate your thoughts on any of this.  Thanks for your time.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list