user1166981
user1166981

Reputation: 1746

How do C programmers work with the MSDN API examples which are in C++?

I am getting into GUI programming with C for fun. I presume that GTK isn't complete enough to deal with potentially all the win32 calls that can be made/hooked. I've gone through the examples from the few sites I could find that give tutorials on the common API calls (with C focus), but when I look up the MSDN on API calls that aren't covered, I see that the explanations/examples are in C++. What do C programmers do at this point?

Upvotes: 2

Views: 181

Answers (1)

Nikos C.
Nikos C.

Reputation: 51910

The examples aren't really there for people to directly copy&paste them. They're just examples. Even if the example is in C++, it gets the point across both for C as well as C++ because both languages share a lot of syntax. And since WINAPI is a C API, even when used with C++, the example code is going to be quite compatible with C; there aren't any classes or templates or anything else C++-related in WINAPI.

As for the reason MS is doing this, it's because Visual Studio is a C++ environment. Yes, there's a C89 compiler included, but it's just for backwards compatibility.

Upvotes: 1

Related Questions