Linked by Thom Holwerda on Mon 7th May 2007 15:39 UTC, submitted by Kelly Rush
SkyOS After months of work, there is now a new complete C++ API for SkyOS, which replaces the old C API. The C++ API consists of more than 150 classes, including support for thread and process information, full GUI support, and gesture support, to name a few. Additionally, news about the LiveCD and some of the technology behind it has been updated, including a few screenshots of the LiveCD in action.
Permalink for comment 238036
To read all comments associated with this story, please click here.
RE: c++ is fine for bindings
by nevali on Mon 7th May 2007 18:51 UTC in reply to "c++ is fine for bindings"
nevali
Member since:
2006-10-12

C++ is link-compatible with C (when symbols are exported using extern "C"). If a runtime can load C modules, it can also load C++ modules with C entry points, and thus it is absolutely no harder to write C++ modules than it is to write C modules for those runtimes.


Er, yes, of course you can export symbols as extern "C", but only functions which are compatible with a C-style calling-convention: you can't export class members, or for that matter whole classes, let alone namespaced symbols (without losing the namespacing). If every API was declared extern "C", there wouldn't be any sense in calling it “a C++ API", it'd just be "a C-style API that happened to be written in C++ [entirely an implementation detail]". Producing "a C++ API" ceases to be an implementation detail, because it dictates the language bindings you must use unless you're incredibly careful. And yes, BeOS's APIs were all C++, but aside from projects like Haiku it's not really had a lot of longevity; it would be stretching the truth a little to say that BeOS's API was a good example of a successful C++-only API.

As has been said, the C bindings are typically the greatest common factor between languages (which is both a strength and a weakness, of course), which is why they're provided. There are methods—such as (XP)COM—that you can use to make C++ classes callable from non-C++ code, but you really have to plan ahead for it. Inevitably, as soon as you create bindings for any sort of interpreted language, you'll find that you're having to encapsulate your classes in very C-like wrappers.

Reply Parent Score: 2