Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Wrapper

This topic is 5989 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have just wrote a wrapper class for all my Win32 app''s. When I include the header file, I have to manually insert the source file into all my projects. How would I not have to do this? At first, I thought I might have to make a .dll or .lib, Is this the right way to do it, or should I just define the class in the header file? Hey man, I don''t wanna sound like a queer or nothin'' but i think unicorns kick ass! -> Orgasmo.

##### Share on other sites
the normal way to do this is to compile the .cpp file to an object file, then add this to the link phase. In visual C++ this is done automatically by adding the cpp file to your project. If the class is a wrapper, you may want to consider just making everything inline. This is normally done by just adding the body in the class definition.

class foo {  int x;public:  void reset() {x=0;}};foo bar;bar.reset();

in the above example when the compiler sees bar.reset() it replaces it with {bar.x=0;} inline functions are almost like macros except that the compiler is aware of them and can work a good bit more magic upon them.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632987
• Total Posts
3009726
• ### Who's Online (See full list)

There are no registered users currently online

×