I want to make some functions that I expect I will use again and again, but I don't want to copy and paste them everytime I make a program that will use them. My thought was to make a .h file with a namespace. Would that work? Or would I have to make a .dll? If so, how would I go about doing that? Thank you very much.
Rand al'Thor
0
Newbie Poster
Recommended Answers
Jump to Post> My thought was to make a .h file with a namespace. Would that work?
yes, provided that all the functions in the header have internal linkage. ie. they are inline or put in an anonymous namespace (or have the deprecated static linkage specifier). and you have an include guard …
Jump to Post>>What do you mean by the functions having an internal linkage?
>>Also, from my understanding, an anonymous namespace is just one without a name, so how would I call that?
The same way you do all other functions in the standard C/C++ libraries …
All 5 Replies
vijayan121
1,152
Posting Virtuoso
Rand al'Thor
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
Rand al'Thor
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.