I know what wglGetProcAddress does and all, and I would like to use it; however, I am currently working on a project where I am not able to use wglGetProcAddress. Does anyone know how I can accomplish the task that it does, without actually using it?

Btw, if any of you don’t know what wglGetProcAddress is, it is simply a function that takes a string and finds the address to that extension function.


–the Rabid_Stick

Hello…I know this might be obvious…but why not load up the library at run-time instead of linking when compiling?

Or have you already tried that!?

I don’t understand what you mean…
How will loading up the library at runtime help me to determine the address of extension functions?


–the Rabid_Stick

Why can’t you use it???

Why do I always get this question?

A. that shouldn’t matter
B. because my boss says so…

But asking me why I don’t use it doesn’t help me…


–the Rabid_Stick

The only other way to accomplish the same thing is to connect to the GL DLL and get the appropriate function using symbol table enumeration. Seeing as that’s a lot less portable and more fragile than wglGetProcAddress, you are faced with a need to 1) convince your boss it’s OK to use it or 2) do without.

So are you saying that you are programming for Win9x but are not allowed to use wglGetProcAddress() ?

Or are you doing multiple platforms?

dlopen() & dlsym() -> linux
GetProcAddress() -> win32

[This message has been edited by drakaza (edited 08-05-2000).]

Well, you’re going to get the question of “why not” when such a question is asked in the first place…

The trick is, there aren’t many solutions, and knowing why you need to avoid using wglGetProcAddress() is pretty much necessary to providing an alternative.

As others have said, if you really want to, you can use GetProcAddress() instead, but this just adds a couple of steps to the process and doesn’t really gain anything.

If portability is the concern, realize that there is no portable way to get function pointers to extension functions. This is a small set of initialization code that is going to have to be written for each platform your application runs on.

Personally, I don’t like the “it shouldn’t matter why I want to do it” mentality of folks asking for help. Quite often the pathology of their situation is in why they want to do it that way as opposed to how to do it; it is very often much, much easier to solve the problem through changing the why as opposed to explaining the how.

Fair enough, I just get pissed because every time I ask any question people are always prying in trying to figure out why.

We are trying to go portable here but guess there’s no good way to do that so I will explain this to my boss and I thank you all for your kindness in helping me.

–the Rabid_Stick

“Portable”. Right.

There is no production-level ported code that doesn’t have some level of #ifdefs in it.

And there is no such thing as portable code, only code that has been ported.