This is the fourth article in the MlFront series. If you are interested in scripting frameworks that can download source code and bytecode, and inter-operate while doing so, please read:
https://diskuv.com/mlfront/overview-4/
TLDR
(Critical, verbatim snippets from article)
I have an old opam package DkSDKFFIOCaml_Std that is a low-level bridge between OCaml and other programming languages. It can be extraordinarily difficult to build, so I made it a mix of pure OCaml source code and prebuilt library downloads. Today I’ll describe how embedded OCaml dependencies like the following simplifies the build process:
module _ = DkSDKFFI_OCaml
(** The bridge between OCaml and other programming languages.
{[ `v1 [
`sec [ `scheme "dkcoder" ];
`blib ["https://gitlab.com/api/v4/projects/62703194/packages/generic/@DKML_TARGET_ABI@/2.1.4/@DKML_TARGET_ABI@-4.14.2-DkSDKFFI_OCaml-2.1.4-none.blib.zip"];
`clib ["https://gitlab.com/api/v4/projects/62703194/packages/generic/@DKML_TARGET_ABI@/2.1.4/@DKML_TARGET_ABI@-4.14.2-DkSDKFFI_OCaml-2.1.4-none.clib.zip"]
] ]} *)
(* And use what you imported ... *)
let () =
ignore (DkSDKFFI_OCaml.Com.create_c ())
One set of designs I created are the MlFront_Archive
package formats:
-
*.blib.zip
- This is the bytecode archive. It is a zip file containing.cma
,.cmi
and some other critical metadata. -
*.clib.zip
- This is the C library archive. It is a zip file containing.so
or.dylib
or.dll
shared libraries, and also the corresponding static libraries.
The important concept is that *.blib.zip
and *.clib.zip
for OCaml are analogous to *.jar
files for Java. The design is available at:
-
Format of packages: https://gitlab.com/diskuv/registries/public-packages#generic-registry-layout
-
Binaries to unpack the packages: https://gitlab.com/dkml/build-tools/MlFront_Archive/-/releases
The remote specification design is in the MlFront_Config
library: