 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Jan 23, 2004 7:04 pm Post subject: In IDE,How to link several lib files into one lib file? |
|
|
I new a lib project, Add several lib files, and Build, but the resulting lib file is only 1k, not the sum of linked lib files. Please tell me how to link these lib files into one lib file in IDE(BCB6), since I don't want to add many lib files in my project.
Thanks!
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Fri Jan 23, 2004 8:05 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
Are the files static libraries or import libraries?
.. Ed
| Quote: | Zhou Heng wrote in message
news:40117e36$1 (AT) newsgroups (DOT) borland.com...
I new a lib project, Add several lib files, and Build, but the
resulting lib file is only 1k, not the sum of linked lib files.
Please tell me how to link these lib files into one lib file
in IDE(BCB6), since I don't want to add many lib files in
my project.
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jan 24, 2004 6:15 am Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
They are static libraries created by File|New|Other|Library. and I'd like to merge them into one static lib.
Thanks.
"Ed Mulroy [TeamB]" <dont_email_me (AT) bitbuc (DOT) ket> wrote:
| Quote: | Are the files static libraries or import libraries?
. Ed
Zhou Heng wrote in message
news:40117e36$1 (AT) newsgroups (DOT) borland.com...
I new a lib project, Add several lib files, and Build, but the
resulting lib file is only 1k, not the sum of linked lib files.
Please tell me how to link these lib files into one lib file
in IDE(BCB6), since I don't want to add many lib files in
my project.
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Jan 24, 2004 7:25 am Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
<zhou_heng (AT) yahoo (DOT) com> wrote
| Quote: | They are static libraries created by File|New|Other|Library.
and I'd like to merge them into one static lib.
|
That's not how static libs work. They are not combined together until the
linking stage of the main executable that is using them. For what you ask,
you would just have to merge the actual code of each lib into a single
project.
Gambit
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Sat Jan 24, 2004 5:00 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
I know of two ways in which that can be done.
As Remy has already said, you could add the individual source file items
that are what were used to create the constituents all of the libraries to a
project and create a new library. This is the easiest way.
The other way is more involved and uses the command line. If you can do it
in the manner Remy mentioned then that is the best way.
If you have the set of object files on your disk then you can do it like
this. This creates a new library of the name result.lib
Create a new directory and copy or move the object files to it.
Make that directory the default directory.
Run this command
for %a in (*.obj) do echo %a & >>result.2
(note that there is a space between the '%a' and the '&')
Edit the file result.2 and delete the '&' character on the last line
Create the new library with this command.
tlib /C result.lib @result.2
If you do not have the set of object files then here is how it might be
done. For this I will pretend that you are doing this to three libraries,
A.lib, B.lib and C.lib
Create a new directory and place copies of the libraries into it.
Make that directory the default directory.
Construct a file for each library containing the list of object files it
contains. It might go like this:
Generate a listing file for each of the libraries. The command line for
each would be like this:
tlib /C a.LIB , a.LST
(do not overlook the comma between the names)
The contents of a list file looks something like this:
--------------------
Publics by module
8087 size = 4
__8087
__access size = 60
___access
hypot size = 117
___org_hypot _hypot
--------------------
Make another file containing only the object file names from the list file.
grep "size =" a.lst >a.2
(there is no 'magic' to the .2 extension, you could use something else)
The file that creates, a.2 in this example, will look something like this:
--------------------
File libname.lst:
8087 size = 4
__access size = 60
hypot size = 117
--------------------
You now have created A.2, B.2 and C.2
Now edit the *.2 files and for each do this:
Delete the first line (the "File a.lst" line)
For each "size =" delete it and whatever follows on the line and
add " &", a space followed by an ampersand
Insert an asterisk (a '*') in column 1 of each line
Make a file for the big library that will be the result in this way:
copy /v a.2+b.2+c.2 result.2
Edit all the *.2 files again, deleting the ampersand (the '&') on the last
line.
Now each of the *.2 files looks something like this:
--------------------
*8087 &
*__access &
*hypot
--------------------
Note that the last line does NOT have an ampersand
Edit the result.2 line and do a search-and-replace to substitute a plus (a
'+' ) for the asterisks.
The result.2 line now looks like this:
--------------------
+8087 &
+__access &
+hypot
--------------------
The '*' is a command for the librarian to create a *.obj file on the disk
for the module of that name in the library.
The '+' is a command for the librarian to add a *.obj file to the library.
The *.2 files are to be response files for the librarian, files whose input
will be accepted as if they came from the command line.
The commands to create the object files on the disk from the libraries would
look like this:
tlib /C a.lib @a.2
tlib /C b.lib @b.2
tlib /C c.lib @c.2
If you have many libraries that is a lot of typing. You could instead do
this from the command line
for %a in (a b c) do tlib /C %a @%a.2
or this from a batch file (note the doubled '%' characters)
for %%a in (a b c) do tlib /C %%a @%%a.2
This command would create the new library:
tlib /C result.lib @result.2
I hope this helps.
.. Ed
| Quote: | Zhou Heng wrote in message
news:40121b7a (AT) newsgroups (DOT) borland.com...
They are static libraries created by File|New|Other|Library.
and I'd like to merge them into one static lib.
|
|
|
| Back to top |
|
 |
Dennis Jones Guest
|
Posted: Sat Jan 24, 2004 5:02 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote
| Quote: |
[email]zhou_heng (AT) yahoo (DOT) com[/email]> wrote in message
news:40121b7a (AT) newsgroups (DOT) borland.com...
They are static libraries created by File|New|Other|Library.
and I'd like to merge them into one static lib.
That's not how static libs work. They are not combined together until the
linking stage of the main executable that is using them. For what you
ask,
you would just have to merge the actual code of each lib into a single
project.
|
Actually, it could be done without merging the source code, but it's a
little tedious. You could extract all of the OBJ's from each LIB, and then
add them all to another LIB. To do so, you would first have to determine
the names of all of the OBJ's in each LIB. This would be done like this:
TDUMP <filename.lib> | grep THEADR
You'll get a list that looks like this:
000020 THEADR S:gvsofttotProjectsRpcRandNumGen.cpp
000400 THEADR S:gvsofttotProjectsRpcRpcSystem.cpp
007A60 THEADR S:gvsofttotProjectsRpcTGenericThread.cpp
009A60 THEADR S:gvsofttotProjectsRpcTRingBuffer.cpp
00B600 THEADR S:gvsofttotProjectsRpcTRpc.cpp
017B20 THEADR S:gvsofttotProjectsRpcTSemaphore.cpp
019940 THEADR S:gvsofttotProjectsRpcTRpcDriver.cpp
01E760 THEADR S:gvsofttotProjectsRpcTRpcServer.cpp
024960 THEADR S:gvsofttotProjectsRpcTRpcClient.cpp
02A3E0 THEADR S:gvsofttotProjectsRpcTMessageQueue.cpp
Once you know the names of the OBJ's, extract them out to disk:
TLIB <filename.lib> *RandNumGen *RpcSystem *TRingBuffer etc.
This will extract the OBJ's into the current directory.
Then, just add them to the new LIB:
TLIB <newfilename.lib> +RandNumGen +RpcSystem +TRingBuffer
Now, the OBJ's that were in filename.LIB are now in newfilename.LIB. Easy,
but a little time-consuming.
- Dennis
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Sat Jan 24, 2004 5:03 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
I know of two ways in which that can be done.
As Remy has already said, you could add the individual source file items
that are what were used to create the constituents all of the libraries to a
project and create a new library. This is the easiest way.
The other way is more involved and uses the command line. If you can do it
in the manner Remy mentioned then that is the best way.
If you have the set of object files on your disk then you can do it like
this. This creates a new library of the name result.lib
Create a new directory and copy or move the object files to it.
Make that directory the default directory.
Run this command
for %a in (*.obj) do echo *%a & >>result.2
(note: char before the right percent sign is an asterisk and there
is a space between the '%a' and the '&')
Edit the file result.2 and delete the '&' character on the last line
Create the new library with this command.
tlib /C result.lib @result.2
If you do not have the set of object files then here is how it might be
done. For this I will pretend that you are doing this to three libraries,
A.lib, B.lib and C.lib
Create a new directory and place copies of the libraries into it.
Make that directory the default directory.
Construct a file for each library containing the list of object files it
contains. It might go like this:
Generate a listing file for each of the libraries. The command line for
each would be like this:
tlib /C a.LIB , a.LST
(do not overlook the comma between the names)
The contents of a list file looks something like this:
--------------------
Publics by module
8087 size = 4
__8087
__access size = 60
___access
hypot size = 117
___org_hypot _hypot
--------------------
Make another file containing only the object file names from the list file.
grep "size =" a.lst >a.2
(there is no 'magic' to the .2 extension, you could use something else)
The file that creates, a.2 in this example, will look something like this:
--------------------
File libname.lst:
8087 size = 4
__access size = 60
hypot size = 117
--------------------
You now have created A.2, B.2 and C.2
Now edit the *.2 files and for each do this:
Delete the first line (the "File a.lst" line)
For each "size =" delete it and whatever follows on the line and
add " &", a space followed by an ampersand
Insert an asterisk (a '*') in column 1 of each line
Make a file for the big library that will be the result in this way:
copy /v a.2+b.2+c.2 result.2
Edit all the *.2 files again, deleting the ampersand (the '&') on the last
line.
Now each of the *.2 files looks something like this:
--------------------
*8087 &
*__access &
*hypot
--------------------
Note that the last line does NOT have an ampersand
Edit the result.2 line and do a search-and-replace to substitute a plus (a
'+' ) for the asterisks.
The result.2 line now looks like this:
--------------------
+8087 &
+__access &
+hypot
--------------------
The '*' is a command for the librarian to create a *.obj file on the disk
for the module of that name in the library.
The '+' is a command for the librarian to add a *.obj file to the library.
The *.2 files are to be response files for the librarian, files whose input
will be accepted as if they came from the command line.
The commands to create the object files on the disk from the libraries would
look like this:
tlib /C a.lib @a.2
tlib /C b.lib @b.2
tlib /C c.lib @c.2
If you have many libraries that is a lot of typing. You could instead do
this from the command line
for %a in (a b c) do tlib /C %a @%a.2
or this from a batch file (note the doubled '%' characters)
for %%a in (a b c) do tlib /C %%a @%%a.2
This command would create the new library:
tlib /C result.lib @result.2
I hope this helps.
.. Ed
| Quote: | Zhou Heng wrote in message
news:40121b7a (AT) newsgroups (DOT) borland.com...
They are static libraries created by File|New|Other|Library.
and I'd like to merge them into one static lib.
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Jan 24, 2004 10:04 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
"Dennis Jones" <djones (AT) nospam (DOT) com> wrote
| Quote: | Actually, it could be done without merging the source code,
but it's a little tedious. You could extract all of the OBJ's
from each LIB, and then add them all to another LIB.
|
Same basic idea - merging the individual pieces from each lib into a new
lib.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Jan 24, 2004 10:05 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
"Ed Mulroy [TeamB]" <dont_email_me (AT) bitbuc (DOT) ket> wrote
| Quote: | The other way is more involved and uses the command line.
If you can do it in the manner Remy mentioned then that is
the best way.
|
You probably meant Dennis on this one.
Gambit
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Sat Jan 24, 2004 10:45 pm Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
Yep.
My wife calls that a senior moment while my sister-in-law calls it a brain
f*rt. <g>
.. Ed
| Quote: | Remy Lebeau wrote in message
news:4012ea8e$1 (AT) newsgroups (DOT) borland.com...
The other way is more involved and uses the command line.
If you can do it in the manner Remy mentioned then that is
the best way.
You probably meant Dennis on this one.
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sun Jan 25, 2004 6:46 am Post subject: Re: In IDE,How to link several lib files into one lib file? |
|
|
"Ed Mulroy [TeamB]" <dont_email_me (AT) bitbuc (DOT) ket> wrote
| Quote: | My wife calls that a senior moment while my
sister-in-law calls it a brain f*rt.
|
For what it is worth, us "younguns" can have them from time to time as well
Well, this youngun, anyway.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|