Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

guidelines on integration of external libraries

  • Loading branch information...
commit 03002d78538b2d2998361949901fcc9d97570f2d 1 parent a30a0b6
Stefano Zacchiroli zacchiro authored

Showing 1 changed file with 36 additions and 1 deletion. Show diff stats Hide diff stats

  1. +36 1 doc/batteries/GUIDELINES
37 doc/batteries/GUIDELINES
@@ -25,4 +25,39 @@ A package may only be included if
25 25
26 26 * It works with Findlib. For most packages, it's already done. Adding
27 27 findlib support is usually a trivial task but it needs to be done
28   - upstream. In the worst case, feel free to contribute a Findlib META-file.
  28 + upstream. In the worst case, feel free to contribute a Findlib META-file.
  29 +
  30 +
  31 +** How to include an external library
  32 +
  33 +Batteries is made mainly of some core underlying libraries (Extlib,
  34 +Camomile, ...). In addition to that, other libraries can be added to
  35 +libraries to provide smooth integration with some of the core
  36 +datatypes of Batteries (e.g., I/O channels, UTF8 strings, ...). We
  37 +call such libraries *external*.
  38 +
  39 +To integrate a new external library
  40 +
  41 +* you should not embed the external library code into batteries
  42 + (duplicated code: bad), rather you should add a dependency on it
  43 + (i.e., both a build-time *and* runtime dependency, properly
  44 + reflected at the Findlib level)
  45 +
  46 +* you should add glue code to integrate the external library into
  47 + Batteries (if there is nothing to be integrated, then probably it is
  48 + not worth to do anything Batteries-related). Here are some
  49 + integration topics you should consider
  50 +
  51 + - IO channels (Batteries.System.IO)
  52 + - ...
  53 +
  54 +* put your glue code under src/libs/LIBRARY_NAME/ and pack it under
  55 + Libs
  56 +
  57 +* in case you plan to integrate several "similar" external libraries
  58 + you should consider offering an abstraction level (i.e., a common
  59 + module interface) over them, so that it is easy to switch from one
  60 + to the other.
  61 +
  62 + Have a look at src/libs/common; put your abstractions there and pack
  63 + them under Libs.Common

0 comments on commit 03002d7

Please sign in to comment.
Something went wrong with that request. Please try again.