Solved

A static library's library??

Posted on 2000-02-14
3
486 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
ID: 2518292
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
ID: 2518431
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
ID: 2530782
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
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.

832 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