[fpc-pascal] writing device driver using FPC

Michael Van Canneyt michael at freepascal.org
Thu Apr 5 10:57:27 CEST 2007



On Thu, 5 Apr 2007, Vinzent Hoefler wrote:

> On Thursday 05 April 2007 08:14, Felipe Monteiro de Carvalho wrote:
> > On 4/5/07, Vinzent Hoefler <JeLlyFish.software at gmx.net> wrote:
> > > And it would mean writing a C to Pascal conversion of an ever
> > > changing kernel interface.
> >
> > All interfaces change when a new version is released,
> 
> Well, I was not talking about justified "architectural" changes (like 
> those from 2.4 to 2.6), but rather about those deliberate changes of 
> the Linux driver ABI sometimes from kernel patch to kernel patch where 
> important structures get reordered and such stuff. Without the actual C 
> macros you are lost. And yes, it's done on purpose to discourage the 
> use of binary only drivers. Additionally it discourages the use of 
> other languages than C when writing device drivers. I did one in Ada a 
> couple of years ago, but trying that these days would be close to 
> suicide or at least get you to the madhouse. ;)

The solution is rather simple, it seems to me: write a small C driver stub
which exposes a uniform interface. All you need to do is recompile this
driver stub, and you're all set: the stuff that links to this stub will 
still function. I think the paragon filesystem driver works like this, 
and I would not be surprised if the vmware modules and nvidea drivers
work like this too.

Could be too naive to be true, of course.

Michael.



More information about the fpc-pascal mailing list