Skip to content

Commit 978145f

Browse files
lukasstadlerfangerer
authored andcommitted
avoid sulong issue with intrinsics returning "void"
1 parent 454af20 commit 978145f

File tree

2 files changed

+7
-1
lines changed
  • graalpython
    • com.oracle.graal.python.cext/src
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

2 files changed

+7
-1
lines changed

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,12 @@ PyAPI_FUNC(void*) truffle_calloc(size_t size) {
718718
return calloc(1, size);
719719
}
720720

721+
// avoid problems with calling "void" intrinsics via interop
722+
PyAPI_FUNC(int) truffle_free(void* ptr) {
723+
free(ptr);
724+
return 1;
725+
}
726+
721727
PyAPI_FUNC(void) register_native_slots(PyTypeObject* managed_class, PyGetSetDef* getsets, PyMemberDef* members) {
722728
if (getsets || members) {
723729
GraalPyTruffle_Set_Native_Slots(managed_class, getsets, members);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/NativeCAPISymbol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public enum NativeCAPISymbol implements NativeCExtSymbol {
169169
// ctypes
170170
FUN_STRLEN("strlen", SIZE_T, Pointer),
171171
FUN_MEMCPY("memcpy", Pointer, Pointer, Pointer, SIZE_T),
172-
FUN_FREE("free", ArgDescriptor.Void, Pointer),
172+
FUN_FREE("truffle_free", Int, Pointer),
173173
FUN_MEMMOVE("memmove", Pointer, Pointer, Pointer, SIZE_T),
174174
FUN_MEMSET("memset", Pointer, Pointer, Int, SIZE_T),
175175
FUN_CALLOC("truffle_calloc", Pointer, SIZE_T),

0 commit comments

Comments
 (0)