On this page:
pre-install

3 Building Native-Code Extensions

 (require make/setup-extension)

The make/setup-extension library helps compile C code via Setup PLT’s “pre-install” phase (triggered by a pre-install-collection item in "info.rkt"; see also Controlling raco setup with "info.rkt" Files).

The pre-install function takes a number of arguments that describe how the C code is compiled—mainly the libraries that it depends on. It then drives a C compiler via the dynext/compile and dynext/link functions.

Many issues can complicate C compilation, and the pre-install function helps with a few:

Many extension installers will have to sort out addition platform issues manually, however. For example, an old "readline" installer used to pick whether to link to "libcurses" or "libncurses" heuristically by inspecting "/usr/lib". More generally, the “last chance” argument to pre-install allows an installer to patch compiler and linker options (see dynext/compile and dynext/link) before the C code is compiled or linked.

(pre-install plthome-dir    
  collection-dir    
  c-file    
  default-lib-dir    
  include-subdirs    
  find-unix-libs    
  find-windows-libs    
  unix-libs    
  windows-libs    
  extra-depends    
  last-chance-k    
  [3m-too?])  void?
  plthome-dir : path-string?
  collection-dir : path-string?
  c-file : path-string?
  default-lib-dir : path-string?
  include-subdirs : (listof path-string?)
  find-unix-libs : (listof string?)
  find-windows-libs : (listof string?)
  unix-libs : (listof string?)
  windows-libs : (listof string?)
  extra-depends : (listof path-string?)
  last-chance-k : ((-> any) . -> . any)
  3m-too? : any/c = #f
The arguments are as follows: