4 ms·
Why no c header files? I was writing against DirectDraw and DirectSound in that time frame using C, so I'm assuming that there were headers. Or did you just not
by pacaro 10y ago
Why no c header files? I was writing against DirectDraw and DirectSound in that time frame using C, so I'm assuming that there were headers. Or did you just not have access to the windows SDK?
- lobster_johnson 10y agoWe had the C header files, but Turbo/Borland Pascal could not read them, it being a different language and all. You had to translate them into Pascal and declare each imported function as something like: function DirectDrawCreate(...): HRESULT; stdcall; external 'ddraw.dll';
- clouddrover 10y agoRudy 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.
- pacaro 10y agoThanks for the clarification. All of this not being helped by the weird macros COM headers used to work in both C and C++ I'm not sure whether I have nostalgia for that time or Stockholm syndrome