Skip to main content
gamedev.net
🔒 Locked

Header-only class libraries

Started by antareus Jul 14, 2003 at 11:46 AM 3 replies 350+ views
Original Post
antareus
antareus
WTL pulls it off somehow. Is there any trick to it? Do you just mark every definition inline and put it after the class definition? Reason is when I write little Win32 wrappers for system-level stuff I don''t want to ship another DLL with the project if I don''t have to. I also want to avoid mixing projects if possible.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
BitBlt
BitBlt
It''s not that difficult:


// Foo.h
//

...

class Foo
{
public:
Foo() {}
~Foo() {}

float Stuff(float param)
{
float tmp;
...
...
return tmp;
}

...

private:
int m_private1;
int m_private2;
};


or

// Foo.h
//

...

class Foo
{
public:
Foo() {}
~Foo() {}

float Stuff(float param);
...

private:
int m_private1;
int m_private2;
};

float Foo::Stuff(float param)
{
float tmp;
...
...
return tmp;
}

antareus
antareus
I figured. As long as the definition is available I won''t need to link anything additional with code using it, correct? (Is that necessarily the same thing as linking?)
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
BitBlt
BitBlt
You won''t have to link anything, just #include the header file.
antareus
antareus
Just making sure. Thanks.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.