The CAPI Manifesto

Walter Bright newshound2 at digitalmars.com
Fri Oct 21 19:33:48 PDT 2011


On 10/21/2011 4:32 PM, Fawzi Mohamed wrote:
>
> On Oct 21, 2011, at 4:20 PM, Fawzi Mohamed wrote:
>
>> The main problem with this approach is how to support different versions of
>> a library, or of OS. It quickly becomes difficult to support anything but
>> the latest, or a fixed version. It works beautifully for mature libs.

Since github has excellent support for branches, I don't see why this is a major 
problem.


>> I still cannot avoid thinking that a C frontend automatically generating D
>> modules with the help of recipes would be a better way. It will need some
>> manual intervention for "difficult" cases, mainly giving manual translation
>> of some macros, but it should be small.
>
> … and it seems that in the time I was offline others came up with the same
> idea...

It's an old idea. The trouble is, as always, the C preprocessor. I'm currently 
converting the openssl .h files, and they are a zoo of metaprogramming using C 
preprocessor macros.

People are going to demand perfect translation if it is automatic.

The only way to do it is to work with the preprocessed output of the .h file, 
and just forget about the preprocessor.


More information about the Digitalmars-d mailing list