NO

Author Topic: Langage interfacing  (Read 3942 times)

Offline henrin

  • Member
  • *
  • Posts: 4
Langage interfacing
« 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').

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?


Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Langage interfacing
« Reply #1 on: September 09, 2022, 05:44:15 PM »
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

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Langage interfacing
« Reply #2 on: September 10, 2022, 02:33:21 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