Is should be possible to use debug info of a library to generate D or other language bindings. Current approaches are SWIG, htod and/or manual coding. The first two do not always work as expected (try using them to make OpenCV bindings) as parser-based converters do not always support all build environment details. Often, you need a fully capable C/C++ compiler to correctly parse headers.

Function information may be extracted from:

* PDB files using DIA SDK on Windows
* DWARF info using libdwarf or libdw on *nixes

Debug files contain information about functions, their argument types and return types, about structs and classes/namespaces (C++). Recent version of DWARF may even contain information about macros.

The usual binding creation would be simple:

1. build library using existing build environment with debug info
2. run converter to generate D bindings (this may be used to make C#'s bindings as well)

Thanks to the 1st point we can avoid many incompatibilities with SWIG/htod parsers as we get all symbols in one file. The whole process may be automated in most circumstances. Eventually some fixup files may be used to assist with conversion (similar to SWIG files, but without enumerating everything).

Thoughts?

Reply via email to