News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Langage interfacing

Started by henrin, September 09, 2022, 03:34:39 PM

Previous topic - Next topic

henrin

I dislike C++ but ... some nice functions are available in C++ only.
Calling them from C is a problem because of the parameter passing convention (th hidden first argument 'this').

I suppose it should not be very difficult to have a function attribute  __cppcall in addition to  __cdecl,  __fastcall,  __stdcall.

Is that a stupid suggestion?


frankie

Not clear what is the point.
C++ functions generally are __stdcall which first argument is a pointer to the class that is added transparently from compiler which knows the class the function belongs to.
In plain C the new function specifier what should be for? Without the whole C++ infrastructure what the compiler is supposed to do differently from the other specifiers?
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

John Z

Quote from: henrin on September 09, 2022, 03:34:39 PM
I dislike C++ but ... some nice functions are available in C++ only.
Calling them from C is a problem because of the parameter passing convention (th hidden first argument 'this').

Maybe this forum thread will be helpful to you:
https://forum.pellesc.de/index.php?topic=10573.0

John Z