Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on Windows #37

Merged
merged 2 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/circllhist.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <sys/socket.h>
#include <math.h>
#include <arpa/inet.h>
#include <ctype.h>

#if !defined(WIN32)
#include <arpa/inet.h>
#include <sys/socket.h>
#endif

#include "circllhist.h"

hist_allocator_t default_allocator = {
Expand Down Expand Up @@ -115,10 +118,19 @@ struct hist_flevel {
};

//! A bucket-count pair
#if defined(WIN32)
#pragma pack(push, 1)
struct hist_bv_pair {
hist_bucket_t bucket;
uint64_t count;
};
#pragma pack(pop)
#else
struct hist_bv_pair {
hist_bucket_t bucket;
uint64_t count;
}__attribute__((packed));
#endif

//! The histogram structure
//! Internals are regarded private and might change with version.
Expand Down Expand Up @@ -1199,7 +1211,7 @@ hist_free(histogram_t *hist) {
struct histogram_fast *hfast = (struct histogram_fast *)hist;
for(i=0;i<256;i++) a->free(hfast->faster[i]);
}

a->free(hist);
}

Expand Down
5 changes: 5 additions & 0 deletions src/circllhist.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
#ifndef CIRCLLHIST_H
#define CIRCLLHIST_H

#if defined(WIN32)
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#endif

#ifdef __cplusplus
extern "C" { /* FFI_SKIP */
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/prepareFFI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cat |\
$GREP -v -F '/* FFI_SKIP */' |\
$GREP -v "^$" |\
$SED 's|//.*$||' |\
$EGREP -v "#if|#endif|#define|#include" |\
$EGREP -v "#if|#endif|#define|#include|SSIZE_T" |\
$SED 's/u_int/uint/g' |\
$SED 's/API_EXPORT(\([^\)]*\))/\1/g' |\
$AWK '/typedef struct histogram histogram_t;/ {print "typedef long int ssize_t;"} /./{print}'