On Mon, May 18, 2026 at 11:20 PM Branko Čibej <[email protected]> wrote:

> On 18. 5. 26 22:27, Ivan Zhakov wrote:
>
> On Mon, 18 May 2026 at 21:24, Timofei Zhakov <[email protected]> wrote:
>
>> On Mon, May 18, 2026 at 5:22 PM Branko Čibej <[email protected]> wrote:
>>
>>> On 18. 5. 26 17:04, Ivan Zhakov wrote:
>>>
>>>
>> [..]
>
>> Yes, especially because the Unix and Win32 versions share a lot of things
>> in common but sometimes need to do it in a slightly different way.
>>
>> Also what do you guys think about the fact that Win32 apr.h includes
>> windows.h? It seems odd to me. APR promises to eliminate platform
>> dependence by wrapping everything into POSIX-ish style API
>>
>
> Cross-platform API. I'm not sure what you mean by POSIX-ish, but APR isn't
> that.
>
>
I mean that the API is similar. For example, apr_file_open() kind of works
almost like fopen(). Not exactly but in my head I have this connection.
Okay their signatures are very different and even naming, but I think there
is some pattern of doing the same thing but in a slightly more modern way
with a bit more control.


> without extra unneeded junk and then all high level code essentially has
>> GetLastError in the scope. I think if one wants to explicitly use win32
>> API, they should include those headers themselves.
>>
>
> It's a good question. I agree that apr.h should not depend on system
> headers like Windows.h. But one reason that Windows error codes are used in
> apr_errno.h.
>
>
> apr.h is a generated, *system-specific* header. Of course it can and
> should depend on system headers if it needs them. It also includes
> sys/types.h and sys/socket.h and sys/wait.h and os2.h and so on, depending
> on the target. That makes perfect sense.
>
>
The question I have is whether we really want it or not.

In reality it's always included in every source file. Take svn_wc.h for
example:

[[[
#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_hash.h>
#include <apr_time.h>
#include <apr_file_io.h>

#include "svn_types.h"
#include "svn_string.h"
#include "svn_checksum.h"
#include "svn_io.h"
#include "svn_delta.h"     /* for svn_stream_t */
#include "svn_opt.h"
#include "svn_ra.h"        /* for svn_ra_reporter_t type */
]]]


> Sure, if anyone wants to use the Win32 API or a pure POSIX API or the
> Linux API or the macOS API along with APR, they have to include those
> headers *before* apr.h.
>
> -- Brane
>
>
>
>

-- 
Timofei Zhakov

Reply via email to