Solved

A static library's library??

Posted on 2000-02-14
3
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ :Change value from  DisableCMD registry 4 80
Syntax Error 2 115
oracle 11g 23 151
eclipse apache tomcat admin console 52 193
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

751 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