Search code examples
c++visual-studiosharing

Sharing source code hiding classes


I should share a project done from several classes in c++ with Visual Studio with other developers. Because the other developers should modify and have access to just one of the classes, I would like to export the project in a way that they have only access to that class and all the others are already compiled to be hidden. What is the correct procedure to do it? Thanks


Solution

  • You should build a lib with all the code you don't want to share.

    Then, make sure the code you want to share can be compiled against the library, with the headers of the private code. That will most likely be two projects. One to build the lib, and one to use it and add the shared class.

    Once it works, share the library and all the headers. You can share the project file for the shared code.

    As pointed out in the comments, libraries require very similar build environments. Something that would work better across compilers is DLL. But those come with greater complexity, and I'd suggest putting mileage on libraries, first.