[SAoC] 'DPP with Linux kernel headers' Project Thread
Cristian Becerescu
cristian.becerescu at yahoo.com
Mon Sep 16 20:51:08 UTC 2019
Hi all,
My name is Cristi and in the next few months I will be working on
the "DPP with Linux kernel headers" project for this year's
edition of SAoC. This thread will be used to post further updates
(though anyone is encouraged to make suggestions, ask questions
and pinpoint mistakes).
DPP is a tool used to directly include C/C++ headers in D files;
it is basically a D compiler wrapper which permits D files with
#include directives to be compiled.
Since D doesn't have a preprocessor, running DPP on a .dpp file
will create a valid .d file that can be compiled (e.g. with dmd).
A .dpp file can include one or more C/C++ headers, each possibly
containing C/C++ macros, and function and structure declarations.
The included headers are parsed using libclang.
At the moment, DPP doesn't work when the .dpp file includes linux
header files. As a consequence, writing a linux driver in D (e.g.
the case of Alex Militaru's driver), implies manually translating
all used C headers to .di interfaces (redeclaring all structures
and functions to a D-compilable format). The project aims to
solve this issue and enable DPP to work with all linux headers.
Milestones for this project:
Milestone 1: Investigate and narrow down the issues that dpp has
with the compilation of linux kernel header files.
Weeks 1-2: Get accustomed with the infrastructure: build the
kernel with clang, clone dpp, understand the internal structure
of both dpp and the kernel.
Weeks 3-4: Compile a .c file with clang that includes a random
linux kernel header, try to reproduce with dpp. There are a
series of issues that need to be addressed:
-> how to pass clang command line options to dpp?
-> what command line options are needed?
-> how to specify what version of libclang should be used?
-> are the object files compatible?
Milestone 2: Fix all issues encountered at milestone 1 so that
Alex Militaru's driver can be integrated with the linux kernel
using dpp.
Unfortunately, we cannot detail too much on this step as it
really depends on what we will discover during milestone 1. We
can provide more information about this at the end of milestone
1. If things go smoothly and we integrate Alex Militaru's driver
very fast, then the next step will
be to create a testing infrastructure that makes sure that dpp
works well with **all** the headers in the kernel.
Milestone 3 + 4: Work on integrating dpp with C++.
From now on, I will be posting updates weekly (or every two
weeks) regarding the progress done on this project.
Quick note: I'm currently in the last two weeks of an internship,
but I will do my best to finish all that I've set out to do.
Many thanks,
Cristi
More information about the Digitalmars-d
mailing list