Skip to content

Commit

Permalink
Add C-linkage to gc extensions for correct compiling in C++ (#30242)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim366 authored and ararslan committed Dec 3, 2018
1 parent 7ea4542 commit 7a5042a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/julia_gcext.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef JL_GCEXT_H
#define JL_GCEXT_H

#ifdef __cplusplus
extern "C" {
#endif

// requires including "julia.h" beforehand.

// Callbacks that allow C code to hook into the GC.
Expand Down Expand Up @@ -121,4 +125,8 @@ JL_DLLEXPORT jl_value_t *jl_gc_internal_obj_base_ptr(void *p);
// *tid will be set to -1.
JL_DLLEXPORT void *jl_task_stack_buffer(jl_task_t *task, size_t *size, int *tid);

#ifdef __cplusplus
}
#endif

#endif // _JULIA_GCEXT_H
8 changes: 8 additions & 0 deletions test/gcext/gcext.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
// range goes from 0 to 2^k-1 (region tables), we simply convert
// to uintptr_t and compare those.

#ifdef __cplusplus
extern "C" {
#endif

static inline int cmp_ptr(void *p, void *q)
{
uintptr_t paddr = (uintptr_t)p;
Expand Down Expand Up @@ -662,3 +666,7 @@ int main()
" include(\"LocalTest.jl\")\n"
"end");
}

#ifdef __cplusplus
}
#endif

2 comments on commit 7a5042a

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.