[Development] Could support for C be added to Qt?

Thiago Macieira thiago.macieira at intel.com
Sun Sep 11 17:44:03 CEST 2022


On Sunday, 11 September 2022 07:45:18 PDT samuel ammonius wrote:
> I assumed that the C++ standard said that the first parameter of a function
> would be "this".

It doesn't. On at least one ABI, the this pointer is passed in a different 
register than the first parameter.

In any case, you can't do that for virtual functions anyway, because the PMF 
of a virtual function doesn't contain the function's entry point, but the 
offset in the virtual table. 

You'll need to wrap each C++ function that you want to call with a full extern 
"C" function whose body you'll generate. You need to have a C++ code parser 
and a binding generator. Take a look at how the Python bindings are generated.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering





More information about the Development mailing list