• Advertisement

Archived

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

Wrapper

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

  • Advertisement