Suppose i have a class called Vector3

methods and attributes are defined in Vce.h file,
methods of this class are implemeted in Vec.cpp file,

now i want to distribute this class to my other xxx(what so ever),

What i want:
1.Allow them to see what methods and attributes are available in this class.
2. Allow them to use methods of these class into their code

What i don't want:
1. I don't want to allow them to see how methods are implemeted.
2. Dont want to allow them to edit this class, but they can enhance the class compability by making their own derived classes using this class as a base.

How to achive this??
I have listen some what that dll and lib files are used for this kinda stuff but don't know how?

Any tutorial, or article related this plz put the link here.

Thanks.
Muhammad Ahmed

If you are using Visual Studio, there is an option in the project properties, to make it either a static library (.lib) or a dynamic library (.dll), or any other IDE should be similar. Then you can simply distribute the library and header files. Then the header files will need to be included in any projects used, and the library files will need to be put on the build path. I believe static libraries are included within the executables, or whatever, and dynamic libraries need to be distributed again. I hope this helps.

>I believe static libraries are included within the executables...
The linker searches static libraries for object (compiled) modules needed to built an executable. For example, suppose you build a static library from v2.cpp and v3.cpp source modules then distribute it. Let your client links the code using v3 features only with this library. The linker extracts only v3 object module from the static library.

http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/

Or just give them the .h and .obj files. Others can link those in with their code. .objs are the output from the compiler and used as input to the linker.

This article has been dead for over six months. Start a new discussion instead.