1

EDIT: My question isn't a duplicate of this question, which addresses a conceptual question regarding the usage of Templates. Whereas, the focus of this question is on Hiding code in a header file. While my case involves template functions and thus it's not possible to hide them, answers addressing non-template header files are also appreciated.

QUESTION: How to hide non-template code written in header files from the user? By hiding, I mean something that the system can read by not the user by any means. i.e.: Binary files.

I have a header file containing about 8 template functions. I want to share the header file with my classmates so they can use it but I don't want to share the entire source code with them. Instead of sending them the header file which they can include and use, can I just send them some binary object, which they can link to their code while compilation or something?

I looked up about dynamic and static libraries although not much is present regarding Turbo C++. All that I found was based on usage of GCC.

I wish to be able to send a static library, I even created a .lib file by making a project, adding the header and implementation file but I don't know how to use the said .lib file. As I said, didn't find much related to Turbo C++, most stuff is on simple creation of header files.

Note: I hate TurboC++ but my school is dumb, actually the entire country is dumb, especially in this matter.

  • Possible duplicate of [Why can templates only be implemented in the header file?](https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file) – Mike Kinghan Sep 18 '17 at 17:22
  • @MikeKinghan Isn't he just asking for a way to hide the code from the user? And also, it's Turbo C++. Old has hell! – Alpha Mineron Sep 21 '17 at 15:15
  • @AlphaMineron But you can't hide the code in a binary when it consists of function templates because function templates can only be defined in a header file. Doesn't matter what compiler you use. – Mike Kinghan Sep 21 '17 at 15:29
  • Except in your edit at the top, you don’t mention that you have any non-template functions at all. If you only had templates, it’s impossible and this would be a duplicate. – Daniel H Sep 27 '17 at 18:09

0 Answers0