3 ms·
Rudy Velthuis has a great article on the problems commonly encountered when converting C headers to Pascal (or more specifically Delphi): http://rvelthuis.de/a
by clouddrover 10y ago
Rudy Velthuis has a great article on the problems commonly encountered when converting C headers to Pascal (or more specifically Delphi):
http://rvelthuis.de/articles/articles-convert.html http://rvelthuis.de/articles/articles-convert.html
- lobster_johnson 10y agoYep. As I said in a previous comment, I actually released a tool, called htrans, to do this, which worked very well for a lot of people. It was a hand-coded C parser with support for a minimal subset of C++ concepts, needed to successfully translate COM interfaces. It had a bunch of kludges specifically to recognize COM. Handling macros was without doubt the most painful part of it, because I couldn't just run the .h file through a preprocessor; I had to also preserve the macros and try to convert them into declarations, so that "#define FOO 1" would result in "const FOO: Integer = 1;" or whatever. Not too bad with simple things, but sometimes people will abuse macros to declare functions... htrans worked well enough that I could run it on a bunch of stuff and not need to edit the resulting .pas files at all. Unfortunately, I suspect I've lost the source code.