Libraries and executables

What is a library?

A library consists of:

A library lives in:

An executable has the same format; the two are distinguished by their distinct _rmx_type fields in DB records ("library" and "executable"), but also the isexe field in their headers. The format is defined in code here and here. For both kinds of DB records, the actual bytecode is stored in a subrecord so that you can query just the metadata without pulling in the whole program. (The bytecode field is dataRef.) See DB layout below for details. By convention, the executable has name "$executable", version 0, and hash "x" when we need to use this scheme to refer to something that might be in either a library or the executable. (Note that this version and hash are illegal for libraries.)

When compiled, a library or executable depends on a (possibly empty) set of dependency libraries, which are fixed at a specific version. If you update a library, you should recompile all libraries and executables that use it. There is a special library, "stdlib", which is available directly from the compiler, and is updated when the compiler build is updated. When compiling a library or executable, the current stdlib is saved to the database, so updating the server build does not break linking for existing executables, but once anything has been recompiled the whole app should be, to use a consistent version of the stdlib. It is possible to statically link some or all of the dependency libraries into the executable, or delay linking until load or run time.

Create a library with mixc

$ mixc -app myapp -url <http://localhost:8001> -mklib mylib -directory dir

What it does:

Dependencies:

What does it mean when a library is in the current project?

List libraries

$ mixc -app myapp -url <http://localhost:8001> -list-libs
$ mixc -app myapp -url <http://localhost:8001> -list-all-libs

Create an executable using libraries

$ mixc -app myapp -url <http://localhost:8001> -directory dir