Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

A static library's library??

Posted on 2000-02-14
3
Medium Priority
?
501 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

971 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