Skip to content

Commit

Permalink
fixup! Allow re-initialization and caching of foreign types (#47407)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Nov 28, 2022
1 parent c591e39 commit 5d50292
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/gcext/Foreign/src/Foreign.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Foreign

using Libdl

const foreignlib = joinpath(dirname(joinpath(@__DIR__)), "deps", "foreignlib.$(dlext)")
const foreignlib = joinpath(ENV["BINDIR"], "foreignlib.$(dlext)")

const FObj = ccall((:declare_foreign, foreignlib), Any, (Any, Any, Any), :FObj, @__MODULE__, Any)
FObj() = ccall((:allocate_foreign, foreignlib), Any, (Ptr{Cvoid}, Csize_t, Any,), Core.getptls(), sizeof(Ptr{Cvoid}), FObj)::FObj
Expand Down
12 changes: 6 additions & 6 deletions test/gcext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ $(BIN)/gcext$(EXE): $(SRCDIR)/gcext.c
$(BIN)/gcext-debug$(EXE): $(SRCDIR)/gcext.c
$(CC) $^ -o $@ $(CPPFLAGS_ADD) $(CPPFLAGS) $(CFLAGS_ADD) $(CFLAGS) $(LDFLAGS_ADD) $(LDFLAGS) $(DEBUGFLAGS)

$(BIN)/Foreign/deps/foreignlib$(DYLIB): $(SRCDIR)/Foreign/deps/foreignlib.c
$(BIN)/foreignlib$(DYLIB): $(SRCDIR)/Foreign/deps/foreignlib.c
$(CC) $^ -o $@ $(DYLIBFLAGS) $(CPPFLAGS_ADD) $(CPPFLAGS) $(CFLAGS_ADD) $(CFLAGS) $(LDFLAGS_ADD) $(LDFLAGS)

$(BIN)/Foreign/deps/foreignlib-debug$(DYLIB): $(SRCDIR)/Foreign/deps/foreignlib.c
$(BIN)/foreignlib-debug$(DYLIB): $(SRCDIR)/Foreign/deps/foreignlib.c
$(CC) $^ -o $@ $(DYLIBFLAGS) $(CPPFLAGS_ADD) $(CPPFLAGS) $(CFLAGS_ADD) $(CFLAGS) $(LDFLAGS_ADD) $(LDFLAGS) $(DEBUGFLAGS)

ifneq ($(abspath $(BIN)),$(abspath $(SRCDIR)))
Expand All @@ -59,14 +59,14 @@ $(BIN)/LocalTest.jl: $(SRCDIR)/LocalTest.jl
cp $< $@
endif

check: $(BIN)/gcext$(EXE) $(BIN)/LocalTest.jl $(BIN)/Foreign/deps/foreignlib$(DYLIB)
$(JULIA) --depwarn=error $(SRCDIR)/gcext-test.jl $<
check: $(BIN)/gcext$(EXE) $(BIN)/LocalTest.jl $(BIN)/foreignlib$(DYLIB)
BINDIR=$(BIN) $(JULIA) --depwarn=error $(SRCDIR)/gcext-test.jl $<
@echo SUCCESS

clean:
-rm -f $(BIN)/gcext-debug$(EXE) $(BIN)/gcext$(EXE)
-rm -f $(BIN)/Foreign/deps/foreignlib$(DYLIB)
-rm -f $(BIN)/Foreign/deps/foreignlib-debug$(DYLIB)
-rm -f $(BIN)/foreignlib$(DYLIB)
-rm -f $(BIN)/foreignlib-debug$(DYLIB)

.PHONY: release debug clean check

Expand Down

0 comments on commit 5d50292

Please sign in to comment.