IMHO it depends on what C++ part you want to translate to Delphi.
I can confirm that Dr Bob C to Pas Header convertor work perfectly as I expect.
This way, it only translate the C header (*.h) for later used as wrapper/binding to that C library (*.dll)
I can give you a prove. This file is tranlated to pas:
https://github.com/x2nie/Embroidermodder/blob/master/experimental/delphi/binding/libembroidery.pastranslated from several of C header files listed here:
https://github.com/x2nie/Embroidermodder/tree/master/libembroideryIf you failed to translate from C/C++ to pas, you can't hate the weapon you are using.
In my experience, there is no one step for solving all cases of translation. You will always
need to modify some code to get pascal code properly.
Let say you only need to translate the header C. It's not really easy IMHO:
The usual problem is pointer in C is similar as C's array.
When in pascal, that two kind is very different from the beginning of how it declared.
The other common problem is how to distinct that C array to be keep as array or to be a "var" parameters (in/out) in pascal function.
No? not only C header code?
You might want to translate the C/C++ code to pascal/Delphi...
I've experience doing this. I've progress in a project translating the whole C++ code to pascal.
This way, I did manually line by line, function by function, everything manually. It is idot way, but At least I able to control the progress of such features of development.
But I still always worry about the result, since both has different approach specially in memory management.
I cant make sure whether the translated pascal code has had identic result according the original program written in C/C++ one.
Another better approach (rather than reinvent the wheel), I recommend you to use SWIG.
It is widely used to translate C/C++ code to Python and vise-versa from Python to C.
But SWIG is not limited to C, it seem able to translate from/to almost nowadays programming language, except Delphi.
Why?
Why there is pascal doesn't supported yet by SWIG?
I think only idiot people want to do anything alone. Meaning Pascal language has been too close/near to C or C++ code,
I think pascal people don't require to translate all the code from C to Pas
I think pascal only need to know the generic part of C/C++ code to play with the rest C code.
Meaning, pascal only requires header part, not the whole code to run C program.
If we can do something easier, why we have to make something harder?
What do you think?
PS:
Swig repository :
https://github.com/swig/swig