Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Bob Swart (aka Dr.Bob) - Medical Officer Dr.Bob's Delphi Clinics
 Dr.Bob's HeadConv - C DLL Header Converter v4.20
See Also: Dr.Bob's SwarTools for Delphi and C++Builder

This is my last version of the free C DLL header converter. For the past year and a half Project JEDI member Alan C. Moore has been working closely with me to reorganize the source code for HeadConv. That task is now complete. You may download the JEDI edition from the Converting APIs article.
For more information about porting C APIs and C DLL header files, see my detailed article Using C DLLs with Delphi, or download the latest version v4.20 of the command-line and Wizard editions of HeadConv v4.20.

*** HeadConv 4.20 (c) 2000/12/16 by Bob Swart (aka Dr.Bob - www.drbob42.com) ***
    FINAL DELPHI-JEDI COMMANDLINE EDITION

    version  date     comments
    ==========================----------------------------
    3.00 - 97/10/03 - first HeadConv command-line edition!
    3.01 - 97/10/10 - generate only "dynamic" import units
    3.02 - 97/10/13 - 3rd pass: convert all ": P" to "var"
    3.03 - 97/10/13 - 3rd pass: don't do 3.02 for "PChar"s
    3.04 - 97/10/14 - skip list of un-needed pointer types
    3.05 - 97/10/15 - add a real typename to "_1" typedefs
    3.06 - 97/10/15 - adjust the indentation (2) for types
    3.07 - 97/10/15 - make "DLLHandle" of the THandle type
    3.08 - 97/10/15 - 3rd pass: skip 3.02 within all types
    3.09 - 97/10/16 - fixed problem with arrays and spaces
    3.10 - 97/10/17 - fixed the typedef "_" prefix problem
    3.11 - 97/10/17 - added multiple typedef names support
    3.12 - 97/10/17 - added LPWSTR -> PWideChar conversion
    3.13 - 97/11/03 - Pointer doesn't become "var :ointer"
    3.14 - 97/11/04 - "cdecl" and optional win32 "stdcall"
    3.15 - 97/11/04 - accepting a "void *" function result
    3.16 - 97/11/07 - fixed a bug in comments for typedefs
    3.17 - 97/11/11 - skip used comments in implementation
    3.18 - 97/11/12 - added argument -o to force overwrite
    3.19 - 97/11/12 - fixed problem with multiple typedefs
    3.20 - 97/11/12 - suspend after __DR_BOB_HEADCONV_STOP
                      restart with __DR_BOB_HEADCONV_START
    3.21 - 97/11/13 - GetProcAddress case-sensitive import
    3.22 - 97/11/14 - Assert around GetProcAddress results
    3.23 - 97/11/14 - Created "procedure LoadDLL" for init
    3.24 - 97/11/21 - re-introduced "static" import units!
    3.25 - 98/04/12 - fixed a rare "type" conversion issue
    4.00 - 99/07/17 - final HeadConv command-line edition!
    4.20 - 00/12/16 - HeadConv command-line DARTH edition!

Usage: HeadConv filename
  will generate the explicit (dynamic) Delphi import unit,
  where filename.H is the C DLL header file.

Command-line Arguments:
  -o to force overwrite of pascal unit on disk

  -x to force generation of eXplicit import unit (dynamic)
  -m to force generation of iMplicit import unit (static)

Example: HeadConv SAMPLE -o

DR.BOB LAUNCHES HEADCONV 1.00
C DLL HEADER CONVERTER EXPERT FOR DELPHI

Helmond, The Netherlands -- August 1, 1995 -- Dr.Bob has announced he will launch the first C DLL Header Converter Expert for Delphi, HeadConv 1.0. Targeted at the serious Delphi developer, the HeadConv Expert will assist in the process of converting C DLL header files to Delphi import units, giving all Delphi users access to the huge world of third-party C DLLs.

HeadConv has full support for functions and procedures, argument and return types (128 custom type conversions) and generates implicit Delphi import units. The expert is integrated in the Delphi IDE, making the conversion very easy as the converted file is opened up in the IDE automatically. At this time there is limited (non-complex) support for typedefs, structs, unions, enums and conditional compilations. HeadConv is not targeted to do the conversion 100% on its own, rather it will assist in converting the C DLL header files!

"The whole idea of a C header translator is really great. I think in the long run it will prove more useful than a VB-Delphi translator because so much of the useful low level code that is suitable for a compiled language like Delphi's ObjectPascal is written in C." said George Watson, a tester.

Another beta tester was equally excited. "It already saved us two days of monkey work, even when not everything was converted 100% correctly."

Although HeadConv started as a shareware utility, it is now offered as freeware (as special support for the JEDI initiative).


HeadConv is freeware, provided as-is, but use at your own risk (I cannot be held responsible for anything that goes wrong while using this tool), but I'm open to feedback, suggestions and other comments by e-mail to info@eBob42.com.
This webpage © 1995-2009 by Bob Swart (aka Dr.Bob - www.drbob42.com). All Rights Reserved.