Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

using a static library from a static library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Manny Silva - 11 Jul 2005 20:49 GMT
Hi,

  I would like to create a static library that uses and in effect adds to
another static library.  I could simply add functionality to the existing
library, but functionally it doesn't really belong there... that is, the one
library is very inspecific.  The Library I need to create will be project
specific, and I prefer not to have to mix the two... in any case, I tried to
create a library that referenced the first library.  I added the library
(such_n_such.lib) to the "Additional Dependencies" property, under the
Librarian category in the project properties (I'm using VS2003, btw).  Then,
immediately below that, I added the configuration dependent path in the
"Additional Library Directories" property (e.g. -
C:\Code\...\$(ConfigurationName))

  Now, before I added a single line of code to the wizard generated
project, it compiled, giving me tons of warnings about such and such already
exists.  It appeared to have been trying to build both the .lib file and all
of the .obj files in the directory.  And when it was done, the library file
that it built was almost three times the size of the library that I was
trying to include.  Now, I know relatively little about staticly linked
libraries, but I was under the impression that when you statically link, it
only brings in the portions of that library that are used... so does anyone
have any idea why I am getting these odd results or what I can do to bring
about the desired results?

Signature

Thanks in advance for your help,
Manny

Steve Alpert - 12 Jul 2005 12:28 GMT
When you link with a library, the smallest unit that can be incorporated from
the library is a "compilation unit", normally a .c or .cpp file.  You can't pull
 in individual functions unless they are the only thing in the unit itself.  Is
it practical to make a DLL out of the LIB and do a dynamic load of the DLL and
GetProcAddress() for the functions you want to present from your DLL?

/steveA

> Hi,
>
[quoted text clipped - 20 lines]
> have any idea why I am getting these odd results or what I can do to bring
> about the desired results?

Signature

Steve Alpert
my email Fgrir_Nycreg @ vqk.pbz is encrypted with ROT13 (www.rot13.org) and spaces

Manny Silva - 12 Jul 2005 19:42 GMT
Signature

Thanks in advance for your help,
Manny

Well, it's not impossible, but the goal is to end up with a single
executable that will not rely upon anything external (for the sake of
portability)...  but I also need a full install, that doesn't have to be
portable and can be dependent on whatever.  Both need to draw functionality
out of a static library that I have, but both will need more functionality
that will be shared.  So I thought that the best way to go about that would
be to create a new static library that built on top of the first.  In the
install, I would use the new library in an ATL DLL.  In the portable app, it
would be linked in.

In the first e-mail I describe my method for creating the new library... and
that is all that I do... without adding a single line of code... the new
library compiles, and I get TONS of warnings (perhaps one per method in the
original library, but that is not for certain) exactly as follows:

cryptlib.lib(rdtables.obj) : warning LNK4006: "void __cdecl
Rijndael_VC60Workaround(void)" (?Rijndael_VC60Workaround@@YAXXZ) already
defined in cryptlib.lib(rdtables.obj); second definition ignored

as if I were including the library twice?? and the original library is
26.8MB (the debug version) - the new one is 50.8MB, again without a single
line of code added...  I can't for the life of me understand why this is...

is there some sort of project setting/compiler flag that will cause this
project to do what I want it to do?  This really just doesn't make any sense
to me...

Thanks for your help,
Manny

> When you link with a library, the smallest unit that can be incorporated from
> the library is a "compilation unit", normally a .c or .cpp file.  You can't pull
[quoted text clipped - 3 lines]
>
> /steveA
Manny Silva - 13 Jul 2005 00:01 GMT
Steve,

  Thank you much for your help.  As it turns out, the answer to my problem
is that a static library can simply use the methods in another static library
without linking to it.  Then, any project that links to this library will
have to also link to the other as well, but this is fine.

Thanks again,
Manny

> When you link with a library, the smallest unit that can be incorporated from
> the library is a "compilation unit", normally a .c or .cpp file.  You can't pull
[quoted text clipped - 3 lines]
>
> /steveA

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.