none
How to write header file for static lib? RRS feed

  • Question

  • So I've recently made an extensive static link library and that is left to do is add a header file for user to call those methods from the lib.

    Now I understand how to do it with methods I just write a methods without stuff in curly brackets.

    But what do I do with enums,structs,operators and constants declared outside methods

    Saturday, October 12, 2019 3:30 PM

Answers

  • But what do I do with enums,structs,operators and constants declared outside methods
    Include them in your header.  How else would a user of your static lib be able to use them?
    • Proposed as answer by Guido Franzke Monday, October 14, 2019 5:50 AM
    • Marked as answer by BataBo Jokviu Wednesday, October 16, 2019 5:53 PM
    Saturday, October 12, 2019 4:04 PM

All replies

  • But what do I do with enums,structs,operators and constants declared outside methods
    Include them in your header.  How else would a user of your static lib be able to use them?
    • Proposed as answer by Guido Franzke Monday, October 14, 2019 5:50 AM
    • Marked as answer by BataBo Jokviu Wednesday, October 16, 2019 5:53 PM
    Saturday, October 12, 2019 4:04 PM
  • A bit of a hint. The C Runtime and Visual C++ standard library are also distributed as a static library. So you can see what is needed there.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Sunday, October 13, 2019 10:42 AM
  • Hello,

    Is your problem solved? If so, please mark the useful replies as answers, so that it will help other members to find solution quickly if they faces similar issue. If you have anything else about this issue, please feel free to contact us.

    Best Regards,

    Suarez Zhou

    Tuesday, October 15, 2019 7:09 AM