How do I use GetProcAddress()/wglGetProcAddress() without type cast?

Yes. I know I must cast returned value to right type, but I saw quake2 source code and found carmack doesn’t cast type at all.

source code is something like this :
qglAccum = GetProcAddress(hModule, “glAccum”);

How is this code compiled without an error?
Some compiler option?
I wanna know how.
Declare function type and cast to it for every single dll function… so annoying.

It’s because the files are compiled as C sources, which have less stringent type checking than if you compile them as C++ sources. There are still warnings however, but I guess he disables them with the line
#pragma warning (disable : 4113 4133 4047 )

-Mezz

Ah. I got it. Thanx.
So, Is there a compiler option (or some #pragma directive) that can alleviate the strictness of type checking as C compiler level?

Why would you want to? More type-checking == good.

Just for dll functions I mentioned above and other similer case.
And Only if option could be turned on/off like #pragma warning.
If not, I’ll cast.

(void *&) qglAccum = GetProcAddress(hModule, “glAccum”);

Assuming GetProcAddress is type void *

lol!

Originally posted by knackered:
lol!

Yes, I know

But, seriously, LOL has something with ROTFL? Am I right?

Originally posted by MichaelK:
[b](void *&) qglAccum = GetProcAddress(hModule, “glAccum”);

Assuming GetProcAddress is type void *[/b]

It works!

One thing I have discovered is that programming is a lot easier if you just do what has to be done to make something work, and ignore things which are ‘annoying’.

So what if you do not like type casts, if there is no other way then just do it and be annoyed by more important things :slight_smile:

Originally posted by MichaelK:
[b] Yes, I know

But, seriously, LOL has something with ROTFL? Am I right?[/b]

Short of sampling myself laughing then emailing you the mp3, I use the common internet short hand for ‘laugh-out-loud’. It’s not something I like doing, using internet shorthand, but it’s pretty difficult to express laughter in any other way.
Maybe I could pretend to be a narrator, and treat myself as the protagonist - something like:
“knackered chuckles warmly to himself at the reverse cast”

Originally posted by knackered:
I use the common internet short hand for ‘laugh-out-loud’.

Is this an idiom? How can you laugh out? Laugh out of what? Laugh out loud? Laugh out very loud? Load ah laud at?

All of this i know this is negative, right?

It’s an americanism.
This is not negative. Well, americanisms are negative, but this discussion is not, if you see what I mean.

What happened to that other guy’s library that does this ****. Lev?

I tried it last weak, but it wasn’t up to date with 1.4

And I said, “What the ****! There must be some mistake here.”

V-man