htonll() and Windows 7

Open Beginner friendly
#922 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp

Research direction

Start in orm_lib/inc/drogon/orm/SqlBinder.h and inspect the existing preprocessor conditions and fallback definitions for htonll() and ntohll(). Done means applications using a Windows 7 SDK can compile and run with the fallback selected, while the existing platform conditions continue to work; consider the proposed configurable SDK macro only if the surrounding discussion supports it.

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem? Please describe.
htonll() (used in orm_lib/inc/drogon/orm/SqlBinder.h) is only available since Windows 8 and when compiling with NTDDI_VERSION>=NTDDI_WIN8. However I'd like to be able to compile and run our applications still on Windows 7.

Describe the solution you'd like
ATVL add a preprocessor condition to the existing ones that determine whether a fallback for htonll() and ntohll() need to be defined ad hoc:

#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__ || \
    defined __MINGW32__ || (defined NTDDI_VERSION && NTDDI_VERSION < NTDDI_WIN8)

Ideally I'd even like to see a custom macro denoting the minimum Windows SDK version to use, which can be set at configuration time, e.g. DR_NTDDI_VERSION which defaults to NTDDI_VERSION. This would separate the concerns of the library and the application (which possibly pulls in a higher Windows SDK version, but is using runtime function bindings).

Additional context

  • OS: Windows 7
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
18h 57m
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drogonframework/drogon

All issues in drogonframework/drogon

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.