chibi-scheme icon indicating copy to clipboard operation
chibi-scheme copied to clipboard

Updating / overwriting what has been loaded by a previous (load "shared_library.so")

Open jf7t2gd1n opened this issue 3 months ago • 1 comments

I have experimenting a little with loading shared libraries using load as in, for example, (load "text.so")

If a function in the shared library is changed and the shared library is recreated, it seems that the second (load "text.so") does not overwrite the first definition of the function.

Is there a way to update what has been loaded previously by the first (load "text.so")?

Thanks.

jf7t2gd1n avatar Nov 27 '25 04:11 jf7t2gd1n

Note in general if you reload a shared library while it's in active use (either via another thread or continuation) your application is likely to crash.

That said, it can be very convenient during development.

The second load will redefine the bindings as with define, which is equivalent to set! if the bindings are already defined (e.g. when run in the same environment). However Chibi inlines all primitives, so existing function definitions will be unaffected. The workaround for now is to also re-evaluate the existing function definitions. But there should also be more control of inlining (see https://github.com/ashinn/chibi-scheme/issues/403).

ashinn avatar Nov 29 '25 13:11 ashinn