Apache "mod_d" needs C to instantiate D interpreter?

Walter Bright newshound2 at digitalmars.com
Tue Nov 9 00:00:34 PST 2010


JFD wrote:
> Yes, you're right.  One should implement Apache module in D.
> 
> One thing is that Apache module entry point expects a "C" function.  I've figure
> that that one could just add extern(C) in front of D function to be callable from
> C, so that was easy.  Also, Apache expects .so shared library, and one could build
> it roughly like this:
> 
> Let DMD build a .a library:
> dmd -fPIC -lib libhello.d
> 
> Then convert it to shared library:
> gcc -shared -Wl,-soname,libhello.so.0 -o libhello.so.0.0 libhello.a
> 
> Could DMD build .so shared library directly (did I miss something)?
> 
> Then it's all D from there on.  Cool!
> 
> Thank you.


One way to make it work is to take a page from how rdmd works. Write the plugin 
in C, have it simply feed its arguments to the dmd compiler, execute, then 
collect the output of the executable.


More information about the Digitalmars-d mailing list