Open andysCaplin opened 3 years ago
We want to use the library on Windows and I found that if the code below is conditionally excluded for WIN32 the library will build and work on Windows. Would it be possible to add this change or something similar to the code.
diff --git a/prom/src/prom_collector.c b/prom/src/prom_collector.c index dce3bb4..f3bd8cf 100644 --- a/prom/src/prom_collector.c +++ b/prom/src/prom_collector.c @@ -15,7 +15,9 @@ */ #include <stdio.h> +#ifndef WIN32 #include <unistd.h> +#endif // Public #include "prom_alloc.h" @@ -119,6 +121,7 @@ int prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Process Collector +#ifndef WIN32 prom_map_t *prom_collector_process_collect(prom_collector_t *self); prom_collector_t *prom_collector_process_new(const char *limits_path, const char *stat_path) { @@ -275,3 +278,4 @@ prom_map_t *prom_collector_process_collect(prom_collector_t *self) { return self->metrics; } +#endif diff --git a/prom/src/prom_collector_registry.c b/prom/src/prom_collector_registry.c index 4c2bc2d..a99573f 100644 --- a/prom/src/prom_collector_registry.c +++ b/prom/src/prom_collector_registry.c @@ -61,6 +61,7 @@ prom_collector_registry_t *prom_collector_registry_new(const char *name) { return self; } +#ifndef WIN32 int prom_collector_registry_enable_process_metrics(prom_collector_registry_t *self) { PROM_ASSERT(self != NULL); if (self == NULL) return 1; @@ -87,14 +88,17 @@ int prom_collector_registry_enable_custom_process_metrics(prom_collector_registr } return 1; } +#endif int prom_collector_registry_default_init(void) { if (PROM_COLLECTOR_REGISTRY_DEFAULT != NULL) return 0; PROM_COLLECTOR_REGISTRY_DEFAULT = prom_collector_registry_new("default"); +#ifndef WIN32 if (PROM_COLLECTOR_REGISTRY_DEFAULT) { return prom_collector_registry_enable_process_metrics(PROM_COLLECTOR_REGISTRY_DEFAULT); } +#endif return 1; }
We want to use the library on Windows and I found that if the code below is conditionally excluded for WIN32 the library will build and work on Windows. Would it be possible to add this change or something similar to the code.