|
-
January 8th, 2009, 05:19 PM
#1
library, qsort, class, static, member access question
Hi There,
So I have something here what I try to resolve but could not so far.
I have something like:
Code:
class CLib {
...
static SortFunc(const void *, const void *);
...
<lots of variables>
...
static CLib *pSelf;
};
CLib::CLib {
pSelf = this;
...
}
CLib::SortFunc(const void *p1, const void *p2) {
if (p1 != 0) {
pSelf->OneVariable = 1;
}
...
}
When I compile and build the library it is fine, However when I link the library I get LNK2019 from Visual Studio (I intend to compile the same code on linux once it works). Okay, accessing non-static variable from a static function is not permitted and I just looked for a workaround. Do you have any clue how to make that work, either by eliminating the linking error or restructuring the code in order to access the non-static variables?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|