Apache Module with D

Pragma ericanderton at yahoo.removeme.com
Fri Jan 26 11:34:52 PST 2007


Robert M. Münch wrote:
> Hi, has anyone here tried to write a simple Apache module using D?
> 
> I have found very few information about how to write Apache modules in 
> C/C++. As I have to write one, I really would like to use D instead of 
> C/C++.
> 
> Maybe it's a good showcase for D.
> 
> --Robert M. Münch
> Management & IT Freelancer
> http://www.robertmuench.de

I tried a few years ago (using DMD 0.97 I think), and didn't get very far.  The major stumbling block was figuring out 
how to mimic Apache's endless use for macros in the C version of their dev kit.  It made for a *very* unfriendly porting 
effort as I had to manually unroll all those macros into D functions.

But I'm not at all saying that you're stuck with C - it's just that you won't be able to easily get away from it 
completely.  If I had to try this again, I'd definitely go with making a generic Apache module in C that is more easily 
used by D as a .lib.  That might also be a good place to handle the various memory management issues that come up when 
you mesh D's GC with a non-gc* managed environment.

That said, I know that there are a few decent tutorials out there to write Apache1 and Apache2 modules floating around 
out there for C.  Everything else I've ever read on the topic, came straight out of the source code comments, and a few 
posts scattered around on Usenet.

(* Apache does have memory pools that are kind of like a crude GC, and shouldn't be at all in the way of D.  Just be 
careful when passing memory back from the D side to C, such that it isn't freed/deleted outside of D.)

-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list