Make S2OPC installed headers independent from platform dependent headers
Description
As of today, some headers in csrc/helpers_platform_dep
include headers from csrc/helpers_platform_dep/${platform}
where platform is either linux
or windows
. However, csrc/helpers_platform_dep/${platform}
are not installed by cmake
. Hence, when an application uses installed headers from csrc/helpers_platform_dep
, it fails.
Analysis
In the future, headers from csrc/helpers_platform_dep
should not rely on platform dependent headers. To do so, struct
s may be moved to C files and typedef
s created in header. Prototypes from the platform independent layer may have to be modified to use the type *
instead of the now incomplete type
.
However, typedef
s to types that are not struct
s cannot be moved to the super .h
.
#define
s yield the same problems.
Fixes
Workaround
A workaround is to add the platform dependent headers to the installed headers.
Defines
#define
s may be replaced by more generic const int SOPC_ = value;
and a declaration in the independent header in the form of a extern const int SOPC_;
.
Unused defines
Some defines from windows' p_sockets.h
are unused: SLEEP_NEXT_SEND_ATTEMP
and MAX_SEND_ATTEMPTS
.
TODO: check in other headers that there are no more unused defines.
typedef
s that are not struct
s
It is not possible to have a generic replacement for these typedef
s.
However, there are two options:
- make
struct
that have a single field; this should not change performances of the implementation, but code using these types must be changed, and_Create
/_Delete
functions must be added, - use a sufficiently large type that may support all needs, such as a
uintmax_t
.
The first option requires more work but is more generic, and unbinds the generic implementation from the platform_dependent one.