Seeking Advice on D Bindings for Large C Library Collection

Tom Browder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 20 05:11:20 PDT 2014


On Tue, May 20, 2014 at 6:10 AM, Rikki Cattermole via
Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
> On 20/05/2014 10:36 p.m., Tom Browder via Digitalmars-d-learn wrote:
>> I am working on a project  to provide D binding files for the C/C++
>> FOSS BRL-CAD project:
...
>> (also with sub-dirs).  I plan to install the generated D interface
>> files (initially as source) in
>>
>>    $BRL/d/
...
> I assume that'll just be the working directory? Since it would be more
> useful as a dub repository.

No, as I have outlined it, it will be the dir for the public D
interface files.  For now I'm just trying to plan a working solution
for the only user: me!   One of the issues I will have to sort out for
any public interface or repo is architecture, etc.  But putting stuff
in a dub repo (if all works) is definitely a next step.

>> I plan to map the C header files this way:
...
> Just a suggestion if you were not aware, but gcc is able to output the
> entire headers as a single file that it is using, given a file.

Yes, I'm aware, but my thought is by going fine-grained, at least in
the beginning, it will be easier to isolate conversion  problems for
manual intervention as necessary.

>> === System Headers and Other, Dependent Library Headers
>>
>> Another major concern is what to do about other, non-BRL-CAD headers:
...
> Don't worry about it. If its really that big of a deal, separate project :)
>
> Although personally I'm more concerned with the usage of templates at least
> from what I saw. That may be a little harder and may require a c lib as well
> to bind it together.

Well, so far  I have not run into any C++ templates in the public API,
but you may be looking at some specific C++ code.  Most of the C++
code I'm familiar with has extern C interface headers.  Sean Morrison,
the BRL-CAD Daddy Rabbit, has intentionally kept the public API
C-usable.

Thanks for the input, Rikki, and your interest.

Best regards,

-Tom


More information about the Digitalmars-d-learn mailing list