neslib/Chet

Chet does not preserve the constness of function / procedure parameters

Closed this issue · 2 comments

First of all I need to say that Chet is excellent in most ways... by far the best C-header-to-Pascal translator available.

One problem I have found with it however (as this issue title says) is that it does not preserve the constness of function or procedure arguments. For example, I recently used it to do a translation of cimgui, which does work fine but for which functions that originally looked like this:

ImColor* ImColor_ImColorVec4(const ImVec4 col);

were translated to stuff like this:

function ImColor_ImColorVec4(col: ImVec4): PImColor;

In that particular case, ImVec4 is a 16-byte struct that certainly should be passed by reference, but that simply won't be no matter what by either Delphi or Free Pascal without the const specifier present.

Funny, I also used created cimgui header translations a while ago before I created Chet. I probably would have run into this issue if I used Chet for it.

Anyway, I just pushed a change with support for const parameters. Let me know if this fixes the issue for you.

That does the trick! Thanks for the quick fix.