Search code examples
schemechicken-scheme

Dynamically Loading Compiled Libraries in CHICKEN-Scheme


I would like to know, if it is possible, the best way to dynamically load compiled code in CHICKEN-Scheme. The API states load only loads source files.

Specifically my goal in dynamically loading code is to be able to overwrite previously defined functions. That is foo in library 1 would get replaced by a different foo in library 2.


Solution

  • The documentation for load says

    On platforms that support it (currently BSD, Haiku, MacOS X, Linux, Solaris, and Windows), load can be used to load compiled programs

    This means you can actually load .so files with load. Replacing an identifier is possible, by simply set!ting it to a different value.

    If you want to dynamically load code from arbitrary directories, I think load is your best bet.