Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] ANN: ppx_blob v0.1
@ 2014-10-11 20:00 John Whitington
  0 siblings, 0 replies; only message in thread
From: John Whitington @ 2014-10-11 20:00 UTC (permalink / raw)
  To: caml-list

Hi,

Ppx_blob is an OCaml ppx to include a binary blob from a file as a
string. Writing [%blob "filename"] will replace the string with the
contents of the file at compile time. This allows the inclusion of
arbitary, possibly compressed, data, without the need to respect OCaml's 
lexical conventions. This allows for smaller executables, and a proper 
separation of data and code.

https://github.com/johnwhitington/ppx_blob

(Shortly with "opam install ppx_blob")

You will need OCaml version 4.02 or later.

For example, assuming the existence of "META" in the current directory:

         OCaml version 4.02.0

# #use "topfind";;
# #require "ppx_blob";;
# let meta = [%blob "META"];;
val meta : string =
   "name=\"ppx_blob\"\ndescription=\"Include a file as a string at 
compile 
time\"\nversion=\"0.1\"\nrequires=\"ppx_tools\"\nppx=\"./ppx_blob\"\n"

The example that comes with ppx_blob is the little quine:

print_string [%blob "quine.ml"]

Thanks,

John Whitington


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-11 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11 20:00 [Caml-list] ANN: ppx_blob v0.1 John Whitington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox