Re: can my library link with a library

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Joe Hagen (jdhagen_at_chorus.net)
Date: 05/09/04


Date: Sat, 8 May 2004 19:31:14 -0600

Stuart,

The LIB utility can combine library as well
as OBJ files.

Extracting the OBJ files isn't as convenient, since
the LIB utility doesn't support extraction using wild-
cards. You must specify each OBJ file separately.
This involves first getting the files using the /list option.

In your case, you can combine all the extra lib files
with your obj or lib files by doing the following:

   lib /out:liball.lib a.lib b.lib c.lib myobj1.obj myobj2.obj

In this example, "liball.lib" is the output file and will
contain all of the object files from the libraries and
any object files specified on the command line.

Joe

Stuart wrote:
> Tim,
> Thanks so much for your help. How do I know what obj files the
> code in my library depends on?
>
> Can you explain how I would extract the OBJ files from all the
> various libs?
>
> thanks,
> Stuart
>
>
>
> "Tim Robinson" <tim.at.gaat.freeserve.co.uk@invalid.com> wrote in
> message news:2g1obmF3d1dpU1@uni-berlin.de...
>> Stuart wrote:
>>> I'm trying to create a static library for use by another
>>> developer. I'm somewhat new to libraries, so my question may not
>>> make sense, but here is what I'm wondering:
>>>
>>> Suppose my library calls functions that require linking with other
>>> libraries. Can I build my library such that it includes those
>>> dependent libraries as one entitiy?
>> [...]
>>
>> A library is just an bunch of .OBJ files within a .LIB file. You
>> could use the LIB program to extract all the .OBJs from the
>> dependent libraries and merge them into yours.
>>
>> If you're not worried about sending out the dependent library files,
>> you can use a #pragma directive to cause a program to link with both
>> libraries. You'd still have to send out several .LIBs when you
>> distributed your library, but you wouldn't have to worry about
>> linking to all of them.
>>
>> For example, in a source file that requires dependent_library.lib:
>> #pragma comment(lib, "dependent_library.lib")
>>
>> --
>> Tim Robinson (MVP, Windows SDK)
>> http://mobius.sourceforge.net/



Relevant Pages

  • Re: can my library link with a library
    ... Can you explain how I would extract the OBJ files from all the various libs? ... I'm somewhat new to libraries, so my question may not make ... >> dependent libraries as one entitiy? ...
    (microsoft.public.vc.language)
  • Re: Getting started on the HP49g+
    ... either the original HP extable lib ... extable2 lib from http://www.hpcalc.org/details.php?id=3940. ... ask again if you have any problem installing libraries. ... compile the string with ASM (listed in the development lib menu, ...
    (comp.sys.hp48)
  • Re: How to "import" an interface into a module w/o `include?
    ... libs but not one file per lib. ... do you mean that you have used 'vlog' to compile your source files ... into ModelSim libraries of those names? ... could possibly know it's an interface). ...
    (comp.lang.verilog)
  • Re: RosAsm is a broken pile of crap
    ... armed with a macro assembler that's ... Even turbo pascal supported libraries (in the form of .tpu ... > Either the Lib is open source and free reuse. ... To use it in RosAsm, you'd have to convert it all to assembly. ...
    (alt.lang.asm)
  • Re: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586
    ... all shared libraries too. ... matched set for the right CPU & release etc. ... But no reason we coudn't have an infrastructure of lib ... It would prevent gcc -march=586 silently failing, ...
    (freebsd-hackers)