You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Justin Erenkrantz <je...@ebuilt.com> on 2001/05/21 02:50:47 UTC

Declaration of apr_terminate() and Win32

On Fri, May 18, 2001 at 12:16:06PM -0700, Ian Holsman wrote:
> also... to get generate_index.c to work on a NT box:
> you'll need to add a 
> static void terminate(void)
> {
>     apr_terminate();
> }
> 
> and change 'atexit' to  atexit(terminate);
> as apr_terminate doesn't have the correct function definition.

[This private thread was originally about the mod_mbox's APR standalone 
program which generates the DBM index files...]

Ian,

I had a chance to look at apr_terminate and it seems that APR defines it
correctly (but again, I only use Unix, so of course, it'd be right).  
What's the error with apr_terminate and MS's C compiler that you were
seeing?

I'm posting this to dev@apr.apache.org in the hopes that someone with a
Win32 compiler has an idea why apr_terminate can't be directly used with
atexit().  If it can't be used directly, it seems that the prototype
should be changed - I think my usage of atexit(apr_terminate) is
correct, but I might be wrong.  Odd.  -- justin


Re: Declaration of apr_terminate() and Win32

Posted by Greg Stein <gs...@lyra.org>.
On Sun, May 20, 2001 at 05:50:47PM -0700, Justin Erenkrantz wrote:
> On Fri, May 18, 2001 at 12:16:06PM -0700, Ian Holsman wrote:
> > also... to get generate_index.c to work on a NT box:
> > you'll need to add a 
> > static void terminate(void)
> > {
> >     apr_terminate();
> > }
> > 
> > and change 'atexit' to  atexit(terminate);
> > as apr_terminate doesn't have the correct function definition.
> 
> [This private thread was originally about the mod_mbox's APR standalone 
> program which generates the DBM index files...]
> 
> Ian,
> 
> I had a chance to look at apr_terminate and it seems that APR defines it
> correctly (but again, I only use Unix, so of course, it'd be right).  
> What's the error with apr_terminate and MS's C compiler that you were
> seeing?
> 
> I'm posting this to dev@apr.apache.org in the hopes that someone with a
> Win32 compiler has an idea why apr_terminate can't be directly used with
> atexit().  If it can't be used directly, it seems that the prototype
> should be changed - I think my usage of atexit(apr_terminate) is
> correct, but I might be wrong.  Odd.  -- justin

I'm guessing that it is due to the stupid fact that APR compiles using
"stdcall" conventions rather than "cdecl" conventions. (i.e. atexit prolly
requires a cdecl function)

This bites us all the time, and it never ceases to peeve me. We're using
stdcall under the (IMO, mistaken) assumption that some random language that
wants to use APR will need APR to be using stdcall conventions. Feh. As if
VB or whatever *can't* call functions that are using cdecl.

It's a mess.

I say: screw it, compile APR as cdecl and be done with it.

Failing that, change the declaration of apr_teminate to use
APR_DECLARE_NONSTD().

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/