Permalink
Browse files

Link in libreadline on the ocamlbuild command instead of in source.

  • Loading branch information...
1 parent 4a65be6 commit d0b68905fab92edc638b017e0caf92d12efd0f11 @technomancy committed Oct 5, 2013
Showing with 6 additions and 9 deletions.
  1. +5 −4 README.md
  2. +1 −5 readline.ml
View
@@ -7,10 +7,11 @@ Fast invocation of Clojure code over nREPL.
## Install
-You will need to install [opam](http://opam.ocamlpro.com/) and OCaml 4.x to be
-able to build Grenchman.
+You will need to
+[install opam](http://opam.ocamlpro.com/doc/Quick_Install.html) and
+OCaml 4.x to be able to build Grenchman.
-If you're not sure whether you have 4.x installed or not, you can check:
+If you're not sure whether you have 4.x installed or not, you can check with:
$ opam switch list
# If your system compiler is 4.x or above, you're ready to go.
@@ -22,7 +23,7 @@ To build, run the following commands:
$ git clone git@github.com:technomancy/grenchman.git grenchman
$ cd grenchman
$ opam install ocamlfind core async ctypes
- $ ocamlbuild -use-ocamlfind grench.native
+ $ ocamlbuild -use-ocamlfind -lflags -cclib,-lreadline grench.native
$ ln -s $PWD/grench.native ~/bin/grench # or somewhere on your $PATH
## Usage
View
@@ -1,13 +1,9 @@
open Ctypes
open Foreign
-let libreadline = Dl.(dlopen ~filename:"libreadline.so" ~flags:[RTLD_NOW])
-
let readline = foreign "readline" (string @-> returning (ptr_opt char))
- ~from:libreadline
let add_history = foreign "add_history" (string @-> returning void)
- ~from:libreadline
let read prompt =
let rec strlen p n =
@@ -29,4 +25,4 @@ let read prompt =
add_history input; Some input
| None -> None
-let _ = (foreign_value ~from:libreadline "rl_readline_name" string) <-@ "grench"
+let _ = (foreign_value "rl_readline_name" string) <-@ "grench"

0 comments on commit d0b6890

Please sign in to comment.