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

Karl Semich 0xloem at gmail.com
Sat Sep 10 01:39:30 CEST 2022


>> There's a couple things I still haven't figured out though, like
>> constructors/destructors and templates. Are there solutions to these that

In C, constructors/destructors usually become alloc/free functions. C
has macros and code generation but these aren’t directly analogous to
templates.

If you share your work some websearcher may find it years down the
road and add on.

Qt is really very C++ based, unfortunately for this idea.

>> would still allow support to be added to Qt internally or would external
>> bindings be better?

It can often be a work of difficult diplomacy to get a project to add
support between c/c++ . Having already done the work can open more
avenues and get more people interested.

> You could just compile your C programs with a C++ compiler, then you could
> use
> Qt as intended, and keep everything else C. While there are differences
> between C and C++ they are few a far between, so generally any C program is
>
> also a valid C++ program.
>
> To me trying to wrap the API is just a way to do things more complicated,
> for
> the sake of making it more complicated.
>
> Best regards

C bindings are often needed to link with other languages that
recognise only C linker symbols, or with codebases designed to run on
embedded systems with no C++ compiler targeting them.


More information about the Development mailing list