www.digitalmars.com         C & C++   DMDScript  

c++.command-line - lib: Is there an append-or-create option?

reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
I don't know why I've never run into this before, but I'm getting

            dmc -c -wx -I..\..\include -Ih:\dev\include -Ih:\dev\incpriv 
 -DWIN32 -DNDEBUG -o.\b64.obj ..\..\src\b64.c
            lib /c /n ..\..\lib\b64.dm.lib 
.\b64.obj,,..\..\lib\b64.dm.lib;
    Digital Mars Librarian Version 8.00n
    Copyright (C) Digital Mars 2000-2002 All Rights Reserved 
www.digitalmars.com

    Error: Create requested, but '..\..\lib\b64.dm.lib' already exists.

Is there an option to create-or-append?

I'm resorting to deleting the lib if it exists in its rule, but it seems 
a bit brutal.

Cheers


-- 
Matthew Wilson

Author: "Imperfect C++", Addison-Wesley, 2004
    (http://www.imperfectcplusplus.com)
Contributing editor, C/C++ Users Journal
    (http://www.synesis.com.au/articles.html#columns)
STLSoft moderator
    (http://www.stlsoft.org)

-------------------------------------------------------------------------------

"So far, C++ is the best language I've discovered to say what I want to 
say" -- Alex Stepanov

-------------------------------------------------------------------------------
Feb 04 2005
parent reply Jan Knepper <jan smartsoft.us> writes:
Yeah... use -+.\b64.obj
That will remove and add it.



Matthew wrote:
 I don't know why I've never run into this before, but I'm getting
 
             dmc -c -wx -I..\..\include -Ih:\dev\include -Ih:\dev\incpriv 
  -DWIN32 -DNDEBUG -o.\b64.obj ..\..\src\b64.c
             lib /c /n ..\..\lib\b64.dm.lib 
 .\b64.obj,,..\..\lib\b64.dm.lib;
     Digital Mars Librarian Version 8.00n
     Copyright (C) Digital Mars 2000-2002 All Rights Reserved 
 www.digitalmars.com
 
     Error: Create requested, but '..\..\lib\b64.dm.lib' already exists.
 
 Is there an option to create-or-append?
 
 I'm resorting to deleting the lib if it exists in its rule, but it seems 
 a bit brutal.
 
 Cheers
 
 

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
Feb 04 2005
next sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Thanks

"Jan Knepper" <jan smartsoft.us> wrote in message 
news:cu0mvc$7lg$1 digitaldaemon.com...
 Yeah... use -+.\b64.obj
 That will remove and add it.



 Matthew wrote:
 I don't know why I've never run into this before, but I'm getting

             dmc -c -wx -I..\..\include -Ih:\dev\include -Ih:\dev\incpriv 
  -DWIN32 -DNDEBUG -o.\b64.obj ..\..\src\b64.c
             lib /c /n ..\..\lib\b64.dm.lib 
 .\b64.obj,,..\..\lib\b64.dm.lib;
     Digital Mars Librarian Version 8.00n
     Copyright (C) Digital Mars 2000-2002 All Rights Reserved 
 www.digitalmars.com

     Error: Create requested, but '..\..\lib\b64.dm.lib' already 
 exists.

 Is there an option to create-or-append?

 I'm resorting to deleting the lib if it exists in its rule, but it 
 seems a bit brutal.

 Cheers

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org

Feb 05 2005
prev sibling next sibling parent Derek Parnell <derek psych.ward> writes:
On Fri, 04 Feb 2005 15:46:36 -0500, Jan Knepper wrote:

 Yeah... use -+.\b64.obj
 That will remove and add it.
 
 Matthew wrote:
 I don't know why I've never run into this before, but I'm getting
 
             dmc -c -wx -I..\..\include -Ih:\dev\include -Ih:\dev\incpriv 
  -DWIN32 -DNDEBUG -o.\b64.obj ..\..\src\b64.c
             lib /c /n ..\..\lib\b64.dm.lib 
 .\b64.obj,,..\..\lib\b64.dm.lib;
     Digital Mars Librarian Version 8.00n
     Copyright (C) Digital Mars 2000-2002 All Rights Reserved 
 www.digitalmars.com
 
     Error: Create requested, but '..\..\lib\b64.dm.lib' already exists.
 
 Is there an option to create-or-append?
 
 I'm resorting to deleting the lib if it exists in its rule, but it seems 
 a bit brutal.
 
 Cheers
 


Thanks! I've just started running in to this problem too. I'm adding the ability to update a library from my 'build' utility and spent a hour or so trying hard to get it working, but failing miserably. -- Derek Melbourne, Australia 7/02/2005 9:30:38 AM
Feb 06 2005
prev sibling parent reply "tjulian" <tjulian removethis.oldi.com> writes:
Jan Knepper wrote:

 Yeah... use -+.\b64.obj
 That will remove and add it.
 

But isn't that considered 'obsolete' usage? Is there a 'new' usage to accomplish this? -- TimJ
Feb 14 2005
parent reply Jan Knepper <jan smartsoft.us> writes:
lib -h
Digital Mars Librarian Version 8.00n
Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com
Documentation: www.digitalmars.com/ctg/lib.html

Obsolete Usage:
         LIB oldlibfile [switches] 
[actionobjs][,[listfile][,[newlibfile]]][;]
     switches:
         /?      Print this message
         /b      Batch
         /c      Create library if one does not exist
         /h      Print this message
         /i      Ignore case of symbols
         /n      Do not create backup file
         /noi    Be case sensitive. Mark library as case sensitive
         /p:number       Set page size to number (a power of 2)
     actions:
         -mod    Delete module
         +mod    Add module
         *mod    Extract module
         -+mod   Replace module
         -*mod   Extract and delete module

New Usage:
         LIB switches... libfile objfiles...
         -c      create
         -d      delete
         -h      print this message
         -i      ignore case of symbols
         -n      do not create backup file
         -l      create .lst file
         -pnnn   set page size to nnn (a power of 2)
         -x      extract


tjulian wrote:
 Jan Knepper wrote:
 
 
Yeah... use -+.\b64.obj
That will remove and add it.

But isn't that considered 'obsolete' usage? Is there a 'new' usage to accomplish this? -- TimJ

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
Feb 14 2005
parent reply "tjulian" <tjulian removethis.oldi.com> writes:
Jan Knepper wrote:

 Obsolete Usage:
          LIB oldlibfile [switches] 
 [actionobjs][,[listfile][,[newlibfile]]][;]
      switches:
          /?      Print this message
          /b      Batch
          /c      Create library if one does not exist
          /h      Print this message
          /i      Ignore case of symbols
          /n      Do not create backup file
          /noi    Be case sensitive. Mark library as case sensitive
          /p:number       Set page size to number (a power of 2)
      actions:
          -mod    Delete module
          +mod    Add module
          *mod    Extract module
          -+mod   Replace module
          -*mod   Extract and delete module
 
 New Usage:
          LIB switches... libfile objfiles...
          -c      create
          -d      delete
          -h      print this message
          -i      ignore case of symbols
          -n      do not create backup file
          -l      create .lst file
          -pnnn   set page size to nnn (a power of 2)
          -x      extract
 

Exactly my point. The '-+mod' syntax is listed under 'obsolete' usage. The 'New' usage does not list 'actionobjs' as an option. -- TimJ
Feb 15 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"tjulian" <tjulian removethis.oldi.com> wrote in message
news:cut3es$n5q$1 digitaldaemon.com...
 Exactly my point. The '-+mod' syntax is listed under 'obsolete' usage.
 The 'New' usage does not list 'actionobjs' as an option.

Just add the .obj file, it'll replace any existing one in the library.
Feb 24 2005
next sibling parent reply Derek Parnell <derek psych.ward> writes:
On Thu, 24 Feb 2005 21:16:52 -0800, Walter wrote:

 "tjulian" <tjulian removethis.oldi.com> wrote in message
 news:cut3es$n5q$1 digitaldaemon.com...
 Exactly my point. The '-+mod' syntax is listed under 'obsolete' usage.
 The 'New' usage does not list 'actionobjs' as an option.

Just add the .obj file, it'll replace any existing one in the library.

This lib tool is driving me crazy! All I want ot be able to do is have it add an object file if the file is not already in the library otherwise replace the object file currently in the library with the new one. And have this work with the response file concept. Here is some actual output from using lib ... ***************************************************** C:\dparnell\D_Proj\build\trunk\Source>del testl.lib C:\dparnell\D_Proj\build\trunk\Source>lib -l -c testl.lib testl.obj testm.obj Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com Digital Mars Librarian complete. C:\dparnell\D_Proj\build\trunk\Source>type testl.lst Publics by name module _D5testl2piFZe testl _D5testm3abci testm Publics by module testl _D5testl2piFZe testm _D5testm3abci C:\dparnell\D_Proj\build\trunk\Source>lib -l testl.lib testl.obj testm.obj Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com Warning: Public '_D5testl2piFZe' already in library, redefinition ignored. Warning: Public '_D5testm3abci' already in library, redefinition ignored. Digital Mars Librarian complete. ***************************************************** This seems to be saying that I *can't* "Just add the .obj file, it'll replace any existing one in the library" as you say. Now if I revert to the obsolete syntax I get this ... ******************************************* C:\dparnell\D_Proj\build\trunk\Source>del testl.lst C:\dparnell\D_Proj\build\trunk\Source>lib testl.lib /c -+testl.obj -+testm.obj,t estl.lst, Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com Warning: 'testl.obj' not found, can't delete or extract it Warning: 'testm.obj' not found, can't delete or extract it Digital Mars Librarian complete. C:\dparnell\D_Proj\build\trunk\Source>type testl.lst Publics by name module _D5testl2piFZe testl _D5testm3abci testm Publics by module testl _D5testl2piFZe testm _D5testm3abci *************************************************** Now it can't find the object files in the library, even though they are plainly there. So has it updated the library or not? I can't tell. Also, you can seem to use the obsolete syntax with a response file ... *************************************************** C:\dparnell\D_Proj\build\trunk\Source>type testl.lsp testl.lib /c -+testl.obj -+testm.obj , , C:\dparnell\D_Proj\build\trunk\Source>lib testl.lsp Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com library file (.lib) testl.lib action-object [-+*] (.obj) /c list file (.lst) -+testl.obj Error: Unexpected char '-' in command line. *************************************************** So, how *do* I replace an existing module in a library? And using a response file? -- Derek Melbourne, Australia 23/03/2005 6:13:07 PM
Mar 22 2005
next sibling parent Derek Parnell <derek psych.ward> writes:
On Wed, 23 Mar 2005 18:23:50 +1100, Derek Parnell wrote:

[snip]

 So, how *do* I replace an existing module in a library? And using a
 response file?

P.S. This is holding up some functionality in the Build utility. -- Derek Melbourne, Australia 24/03/2005 9:08:15 AM
Mar 23 2005
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
Ok, I see your point. What I do (as you can see in the makefiles for Phobos)
is just delete the library and recreate it. Also, to use a response file for
the old syntax, include a blank line for the .lst file.
Mar 24 2005
parent Derek Parnell <derek psych.ward> writes:
On Thu, 24 Mar 2005 01:10:27 -0800, Walter wrote:

 Ok, I see your point. What I do (as you can see in the makefiles for Phobos)
 is just delete the library and recreate it. Also, to use a response file for
 the old syntax, include a blank line for the .lst file.

I understand by this reply of yours that ... (a) The current version of 'lib' cannot replace modules in a library, and (b) You are not going to change that behaviour. Yes, I know I can always recreate a library and this is what Build currently does. However, I was going by the documentation for lib that replacing modules is possible, and I was trying to implement that in Build. I will no longer bother trying to do that, as the alternative method of deleting modules first, then running lib again to add them is not palatable. In fact, I'm not so sure that the delete functionality is working either. -- Derek Parnell Melbourne, Australia 24/03/2005 9:43:02 PM
Mar 24 2005
prev sibling parent "tjulian" <tjulian removethis.oldi.com> writes:
Walter wrote:

 
 "tjulian" <tjulian removethis.oldi.com> wrote in message
 news:cut3es$n5q$1 digitaldaemon.com...
 Exactly my point. The '-+mod' syntax is listed under 'obsolete'
 usage.  The 'New' usage does not list 'actionobjs' as an option.

Just add the .obj file, it'll replace any existing one in the library.

That will work if the library exists, but what if the library does not yet exist and the command to build and insert an obj is in an implicit/inference rule of a makefile? With the new syntax: - adding the -c switch recreates the lib - there is no way to create an empty lib - cannot add to non-existing lib Catch-22 with implicit/inference rules: cannot add to non-existing lib vs adding the -c switch recreates lib. For example with smake: mylib.lib: myfile1.obj myfile2.obj .c.obj: dmc -c $< #how to add to lib if lib does not exist? lib ????? myfile1.obj: myfile1.c myfile2.obj: myfile2.c -- TimJ
Mar 23 2005