1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 03:21:16 +02:00

Fix some portability issues with the new C bindings

Build without GC is unbroken

Fix #10403

Also building tests with Windows (assuming rest of Windows fixes) is
unbroken.
This commit is contained in:
John Ericson 2024-04-04 15:24:42 -04:00
parent 19016c7b52
commit c1e0769355
7 changed files with 25 additions and 13 deletions

View file

@ -17,7 +17,7 @@ libexprc_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libutilc) \
libexprc_LIBS = libutil libutilc libstore libstorec libexpr
libexprc_LDFLAGS += -pthread
libexprc_LDFLAGS += $(THREAD_LDFLAGS)
$(eval $(call install-file-in, $(d)/nix-expr-c.pc, $(libdir)/pkgconfig, 0644))

View file

@ -155,13 +155,13 @@ void nix_gc_now()
}
#else
void nix_gc_incref(nix_c_context * context, const void *)
nix_err nix_gc_incref(nix_c_context * context, const void *)
{
if (context)
context->last_err_code = NIX_OK;
return NIX_OK;
}
void nix_gc_decref(nix_c_context * context, const void *)
nix_err nix_gc_decref(nix_c_context * context, const void *)
{
if (context)
context->last_err_code = NIX_OK;

View file

@ -1,7 +1,6 @@
#include "attr-set.hh"
#include "config.hh"
#include "eval.hh"
#include "gc/gc.h"
#include "globals.hh"
#include "value.hh"
@ -16,8 +15,9 @@
#include <nlohmann/json.hpp>
#ifdef HAVE_BOEHMGC
#define GC_INCLUDE_NEW 1
#include "gc_cpp.h"
# include "gc/gc.h"
# define GC_INCLUDE_NEW 1
# include "gc_cpp.h"
#endif
void nix_set_string_return(nix_string_return * str, const char * c)

View file

@ -1,7 +1,6 @@
#include "attr-set.hh"
#include "config.hh"
#include "eval.hh"
#include "gc/gc.h"
#include "globals.hh"
#include "primops.hh"
#include "value.hh"
@ -13,8 +12,9 @@
#include "nix_api_value.h"
#ifdef HAVE_BOEHMGC
#define GC_INCLUDE_NEW 1
#include "gc_cpp.h"
# include "gc/gc.h"
# define GC_INCLUDE_NEW 1
# include "gc_cpp.h"
#endif
// Helper function to throw an exception if value is null
@ -444,7 +444,7 @@ void nix_list_builder_free(ListBuilder * list_builder)
#if HAVE_BOEHMGC
GC_FREE(list_builder);
#else
delete bb;
delete list_builder;
#endif
}