httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: Whoa! It works!
Date Sun, 13 Jul 1997 23:00:23 GMT
Alexei Kosut wrote:

> On Sun, 13 Jul 1997, Ben Laurie wrote:
>
> [Good stuff deleted]
>
> > You'll note that I've dispensed with dllimport (in fact, it is
> > effectively synonymous with dllexport), and have added __stdcall
> (which
> > you can't do with a .def, so it has to be done this way anyway).
>
> I'm not quite sure I like what you've done with the cpp macros, but I
> haven't decided yet. It seems a bit ugly. What does __stdcall do
> again?

Although we like to think of Windows as a hellish place deviod of
standards, there are a few. One of them is that DLL interfaces use
__stdcall, which puts the arguments on the stack the other way round,
and lets the callee clean up, instead of the caller. This means they
can't do varargs (you just don't __stdcall those), and runs slightly
faster. More importantly, it means the APIs can be used from languages
other than C.

A mildly interesting thing I've noticed is that:

void __declspec(dllexport) __stdcall somefunc();

is legal in C++ but not in C. In C you have to say:

__declspec(dllexport) void __stdcall somefunc();

hence the way I did it.

> And I'm not convinced dllimport is uneccessary. I was having some
> problems with mod_status, where it wasn't reading restart_time
> correctly (which was exported from the core). It may be neccessary to
> add a dllimport to mod_status' restart_time declaration to get that to
>
> work. Although you did forget to tag restart_time with your
> MODULE_VAR_EXPORT thingy.

That'll be because I'm tagging them as they are needed. I thought it
might be interesting, though I have to admit I spoiled it slightly by
tagging most of alloc early on.

Cheers,

Ben.

--
Ben Laurie [Normal service will be resumed as soon as possible]



Mime
View raw message