J
jgraveskc
I know this sounds nasty, but let me explain.
I have what was a class that contains a whole buncha function pointers
(for OpenGL extensions) that are used in the app. I was porting this
app to macs, where the extensions are properly present (just normal
functions) so the class is not needed. I was wanting a way to make
the same code work on both. For example, if I could do this:
glGenBuffersARB(bla); on both. On the mac its just accessing the
OpenGL function, on the Windows machine it would have a using
namespace whatever; at the top and is actually accessing those
function pointers of the same name.
This seemed like it would work fine for my purposes, but I can't seem
to get the namespace pointers to be truly shared across the app. It
seems like every function that wants to use them has to assign them
itself.
Right now it looks like this (this isn't a copy paste [hopefully
obviously] just an example):
namespace whatever
{
static PtrType func1;
static PtrType2 func2;
// etc
InitPointers(); // defined in cpp; assignes all the function pointers
with wglGetProcAddress
};
Any ideas to make this work without having to do a whole lot of #ifdef
WIN32 #else's in the code?
I have what was a class that contains a whole buncha function pointers
(for OpenGL extensions) that are used in the app. I was porting this
app to macs, where the extensions are properly present (just normal
functions) so the class is not needed. I was wanting a way to make
the same code work on both. For example, if I could do this:
glGenBuffersARB(bla); on both. On the mac its just accessing the
OpenGL function, on the Windows machine it would have a using
namespace whatever; at the top and is actually accessing those
function pointers of the same name.
This seemed like it would work fine for my purposes, but I can't seem
to get the namespace pointers to be truly shared across the app. It
seems like every function that wants to use them has to assign them
itself.
Right now it looks like this (this isn't a copy paste [hopefully
obviously] just an example):
namespace whatever
{
static PtrType func1;
static PtrType2 func2;
// etc
InitPointers(); // defined in cpp; assignes all the function pointers
with wglGetProcAddress
};
Any ideas to make this work without having to do a whole lot of #ifdef
WIN32 #else's in the code?