Rolf,
See my comments below.
With the same argument you could say that writing COM objects has
to be done in C++. Yet Wine has lots and lots of COM code written
all in standard C.
You're wrong. COM isn't a full C++ interface, it uses/exposes limited C
++ subset - just to be C and other languages compatible. You never
create a COM class instance C++ way by name (like "= new
Direct3DTexture" or "Direct3DTexture tex;"), you never use ctors/
dtors, you always query/ask for GUID, your COM objects are always
pointers which has to be explicitly freed. You don't link to C++ libs
where are methods and class are C++ mangled using C++ lib naming.
And finally it is opposite situation, it is Wine that implements some
COM interfaces, so it is you that write the COM interface and create C
compatible API too.
I don't think there any place where Wine hooks to existing (external) C
++ library like QT. AFAIK wine uses C POSIX functions and Xwindow API
that is pure C too.
Moreover I didn't say that wrapping Cocoa can't be done in pure-C,
already said that there's a C API to call Obj-C methods etc. (look at
the link below)
All I say it will be a nightmare for a program that uses more than 2
classes and 10 method calls, and implementing video/GUI driver will
trigger much more of them for sure.
Image, you'd need to implement Wine video driver with QT/Kde which is
full C++ interface and all you get from them is C++ headers and C++
libraries.
You couldn't link just to QT lib, because pure C wouldn't understand C+
+ naming, you'd need to use a lot of *dlopen* & *dlsym*s, void
pointers, etc.
Agreed, writing object oriented code in C is not exactly trivial and
often quite tedious and the difference with Object-C might be even
bigger as it is likely using more advanced techniques.
Just to explain things better, I found great sample of calling Obj-C
API within pure C program:
http://www.smipple.net/snippet/moriyoshi/Using%20Objective-C%20ABI%20from%20within%20a%20pure%20C%20code
.
This is basic application that just displays a single window, and YES
it works!
BUT it is 400 lines of code, it is totally obscure.
Having it natively in Obj-C would be ~50 lines of small clean code. So
this is what a call a "nightmare", or maybe "happy coding".
Regards,
--
Adam