Solved

A static library's library??

Posted on 2000-02-14
3
481 Views
Last Modified: 2013-12-14
Suppose I have a static library (which I actually happen to have). And I don't want to change that library, because I like it the way it is. This library is used by a console application, and works fine.

What I want to do now, is to make another static library, which contains the code in the application mentioned above, except that I will alter it to not print anything to standard out, but instead return information to the caller. The static library need to be linked with another static library. Is this possible??

Can I make a static library that needs functions from a static library? If so, how do I do it?

I am using VC++6.0 Enterprise Edition.
0
Comment
Question by:lar_jens
3 Comments
 
LVL 1

Accepted Solution

by:
chytrace earned 100 total points
Comment Utility
Hi,
     I think you can only make a new library with additional calls or classes you need and link your application against both. But this implies that your application code must at some point decide which calls will be used from which library.
The second possbility could be to turn your exisisting library into DLL
and build the new library as DLL as well and to switch between them in run-time dynamically according to your needs. In this case you don't have to change your application's code if the DLL calls have the same signature. With DLLs you must export the symbols you want to use in your application and in your application's code you must import them.
This you can do in DLL header files. More info about bulding DLLs you can fine in the MSDN on-line documenation or its Web version
http://msdn.microsoft.com

Hope this helps

Radovan
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
When you create _your_ static library, just make sure this other static library is linked to it.  i.e. include this other library in the project's workspace.  Then make sure that your library does not export anything that is exported from the other library.  i.e the headers you write for your library should not mention any procedures or data types exported from the other library, only the ones exported from you library.  I think that in that case, you will not nead to link programs that use your library with the other library.  try it.
0
 
LVL 1

Author Comment

by:lar_jens
Comment Utility
Thank you..
I didn't realize it was that simple, but it really is.. =)

I made two static libraries, and linked my new app with both, and I made myself a new header file that just told my app what the functions was named.. And of course, I had no naming conflicts.

Cool..!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now