Skip to content

Instantly share code, notes, and snippets.

View yallop's full-sized avatar

Jeremy Yallop yallop

View GitHub Profile
@yallop
yallop / tyrep.ml
Created July 18, 2023 10:00
Code accompanying "Safe and efficient generic functions with MacoCaml" (OCaml 2023)
type _ prim =
Int : int prim
| Int32 : int32 prim
| Int64 : int64 prim
| Nativeint : nativeint prim
| Float : float prim
| Unit : unit prim
type ('a,'b) iso = {
out: 'a expr -> 'b expr;
@yallop
yallop / after.ml
Created February 15, 2017 12:30
before.ml
(* Generated by mirage configure -t unix (Wed, 15 Feb 2017 10:59:03 GMT). *)
open Lwt.Infix
let return = Lwt.return
let run = OS.Main.run
let _ = Printexc.record_backtrace true
module Unikernel1 = Unikernel.Main(OS.Time)(Pclock)(Mclock)
@yallop
yallop / ber-n102.patch
Created January 10, 2015 16:52
BER n102 patch
diff -Naur ocaml-4.02.1/.depend ocaml-ber-n102/.depend
--- ocaml-4.02.1/.depend 2015-01-10 16:27:54.270865651 +0000
+++ ocaml-ber-n102/.depend 2015-01-10 16:27:06.936030975 +0000
@@ -122,6 +122,9 @@
typing/stypes.cmi : typing/typedtree.cmi parsing/location.cmi \
typing/annot.cmi
typing/subst.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
+typing/trx.cmi : typing/types.cmi typing/typedtree.cmi parsing/parsetree.cmi \
+ parsing/longident.cmi parsing/location.cmi typing/env.cmi \
+ parsing/asttypes.cmi
@yallop
yallop / README.md
Last active June 23, 2018 17:45
Ctypes inverted stubs with a struct of callbacks

Using (ocaml-)ctypes to build a shared library involving structs of function pointers. See the [thread on the ctypes mailing list][thread] for background.

Contents:

  • [bindings.ml][bindings-ml], the inverted bindings themselves
  • [gen.ml][gen-ml], the code generator
  • [load.ml][load-ml], which links the bindings with the generated code
  • [build.sh][build-sh], the build script
  • [client.c][client-c], a client to test the library.