Release notes on OCaml Shared patch #4 --------------------------------------- ELF32 ===== Only Linux i386 is supported, since i don't have access to other ELF32 platforms. Prerequisites: GNU binutils >= 2.12 Shared patch adds following command line options to ocamlopt: -shared Link time. Build shared library. -dynamic Link time. Turn on support for dynamic loading. -noasmrun Don't link libasmrun.a. -nolinkstd Don't link stdlib.cmxa. For instance 'ocamlopt -shared -o shared.so' shared.cmx will create shared library 'shared.so', GNU linker script 'shared.so.a', and OCaml library 'shared.so.cmxa'. To use services, provided by Natdynlink module, '-dynamic' must be specified when linking. This port was tested on RedHat 7.3, Glibc 2.2.5, Binutils 2.12 and later. Win32 ===== Only 'Native MS' port of OCaml is supported. Prerequisites: Everything 'Native MS' port requires. Following ocamlopt command line options where added by shared patch: -shared Compile time. Generate "shared" code. -dynamic Link time. Turn on support for dynamic loading. -nolinkstd Link time. Do not link stdlib.cmxa. -import list Compile time. List of "imported" modules. -dll Link time. Build DLL. Unlike ELF32, this port has two code generation modes: normal and shared. Only modules compiled with -shared can be linked as DLLs, be linked against OCaml produced DLLs or use Natdynlink. Also code produced with -shared must use asmrun.dll(shared runtime) instead of usual libasmrun.lib(static version). Furthermore, if executable or DLL references anything from the module defined in another executable or DLL, this module must be included in import list. Import list is comma separated list of module names and/or "response" files. list ::= spec | spec, list spec ::= Name | !filename Names are case sensitive, no whitespace allowed in response files. Win32 name spaces are not flat, hence care should be taken when using same module in different DLLs/EXEs. (Again in contrast with ELF32). Only standard library is build in both static and shared variants. (Natdynlink is obviously build only as shared) Was tested on Win2k SP2, Microsoft Visual Studio'97 and MASM 6.11d. Backtracing =========== Some limited(hackish) support for backtracing is enabled when code was compiled with '-backtrace' command line option. When 'b' is contained within OCAMLRUNPARAM back traces will be printed even for exceptions raised from C(regardless of '-backtrace'). Trace will include calls from functions where any kind of allocation happens. Re-raised exceptions reset the trace so: let moo a = try ... (* raises End_of_file somewhere *) with Not_found -> ... will print the trace starting with 'moo' (where End_of_file was implicitly raised). ELF32: ocamlopt -c -backtrace exn.ml ocamlopt -ccopt -Wl,-E exn.cmx -o exn OCAMLRUNPARAM=b ./exn Win32: ocamlopt -c -backtrace exn.ml ocamlopt -ccopt -Zi exn.cmx -o exn set OCAMLRUNPARAM=b exn