Skip to content

Commit

Permalink
Add compatibility macros to socketaddr.h
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Jun 9, 2022
1 parent 6a01ae3 commit 5ed4c35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions otherlibs/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ LIBNAME=unix

EXTRACAMLFLAGS=-nolabels

# This flag is used to disable compatibility definitions in header files to
# ensure that they're not accidentally used in the library itself.
OC_CPPFLAGS += -DCAML_BUILDING_UNIX

unixLabels.cmi: \
EXTRACAMLFLAGS += -pp "$(AWK) -f $(ROOTDIR)/stdlib/expand_module_aliases.awk"

Expand Down
8 changes: 8 additions & 0 deletions otherlibs/unix/socketaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ typedef int socklen_param_type;
extern "C" {
#endif

/* Compatibility definitions for the pre-5.0 names of these functions */
#ifndef CAML_BUILDING_UNIX
#define get_sockaddr unix_get_sockaddr
#define alloc_sockaddr unix_alloc_sockaddr
#define alloc_inet_addr unix_alloc_inet_addr
#define alloc_inet6_addr unix_alloc_inet6_addr
#endif /* CAML_BUILDING_UNIX */

extern void unix_get_sockaddr (value mladdr,
union sock_addr_union * addr /*out*/,
socklen_param_type * addr_len /*out*/);
Expand Down

0 comments on commit 5ed4c35

Please sign in to comment.