Skip to content

Commit

Permalink
Merge pull request #514 from yallop/0.11-fixes
Browse files Browse the repository at this point in the history
Prepare the 0.11.4 release
  • Loading branch information
yallop authored May 5, 2017
2 parents dbf053c + aeee034 commit c71ad8d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## ctypes 0.11.4

* Fix function pointer support on no-exec platforms
https://github.com/ocamllabs/ocaml-ctypes/pull/511

Thanks to Matthias Horn (@tiash) for contributing to this release.

## ctypes 0.11.3

* Stub out some `long double` functions that are not supported on NetBSD and OpenBSD
Expand Down
14 changes: 7 additions & 7 deletions META
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.11.3"
version = "0.11.4"
description = "Combinators for binding to C libraries without writing any C."
requires = "unix bigarray str bytes"
archive(byte) = "ctypes.cma"
Expand All @@ -9,7 +9,7 @@ archive(native, plugin) = "ctypes.cmxs"
exists_if = "ctypes.cma"

package "top" (
version = "0.11.3"
version = "0.11.4"
description = "Toplevel printers for C types"
requires = "ctypes"
archive(byte) = "ctypes-top.cma"
Expand All @@ -20,7 +20,7 @@ package "top" (
)

package "stubs" (
version = "0.11.3"
version = "0.11.4"
description = "Stub generation from C types"
requires = "ctypes"
archive(byte) = "cstubs.cma"
Expand All @@ -32,13 +32,13 @@ package "stubs" (
)

package "foreign" (
version = "0.11.3"
version = "0.11.4"
description = "Dynamic linking of C functions"
requires(-mt) = "ctypes.foreign.unthreaded"
requires(mt) = "ctypes.foreign.threaded"

package "base" (
version = "0.11.3"
version = "0.11.4"
description = "Dynamic linking of C functions (base package)"
requires = "ctypes"
archive(byte) = "ctypes-foreign-base.cma"
Expand All @@ -49,7 +49,7 @@ package "foreign" (
)

package "threaded" (
version = "0.11.3"
version = "0.11.4"
description = "Dynamic linking of C functions (for use in threaded programs)"
requires = "threads ctypes ctypes.foreign.base"
archive(byte) = "ctypes-foreign-threaded.cma"
Expand All @@ -60,7 +60,7 @@ package "foreign" (
)

package "unthreaded" (
version = "0.11.3"
version = "0.11.4"
description = "Dynamic linking of C functions (for use in unthreaded programs)"
requires = "ctypes ctypes.foreign.base"
archive(byte) = "ctypes-foreign-unthreaded.cma"
Expand Down
4 changes: 3 additions & 1 deletion src/ctypes-foreign-base/ffi_call_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ struct closure
ffi_closure closure;
intnat fnkey;
struct call_context context;
void* fnptr;
};

enum boxedfn_tags { Done, Fn };
Expand Down Expand Up @@ -589,6 +590,7 @@ value ctypes_make_function_pointer(value callspec_, value fnid)
} else {
closure->fnkey = Long_val(fnid);
closure->context = callspec->context;
closure->fnptr = code_address;

ffi_status status = ffi_prep_closure_loc
((ffi_closure *)closure,
Expand All @@ -610,5 +612,5 @@ value ctypes_make_function_pointer(value callspec_, value fnid)
/* Extract the raw address from a function pointer object */
value ctypes_raw_address_of_function_pointer(value closure)
{
return CTYPES_FROM_PTR(*(struct closure **)Data_custom_val(closure));
return CTYPES_FROM_PTR((*(struct closure **)Data_custom_val(closure))->fnptr);
}

0 comments on commit c71ad8d

Please sign in to comment.