fix(std regex): force native-available init before FFI bindings resolve
ober
6729ac960ee12aa423f1c3d770b1d9746d24d887
--- a/lib/std/regex.ss +++ b/lib/std/regex.ss @@ -83,6 +83,14 @@ ;; Linux and macOS; if the native library is absent the form throws "no entry ;; for". Guard by checking native-available? first. The fallback lambdas are ;; never called because every call site checks native-available? first. + ;; + ;; The line below forces native-available?'s initializer (which calls + ;; load-shared-object) to run BEFORE any (foreign-procedure ...) form below + ;; is resolved. Without this explicit ordering anchor, compile-imported- + ;; libraries with 4+ foreign-procedure forms in this body sometimes resolves + ;; them before native-available?'s init has loaded the dylib, producing + ;; "no entry for jerboa_regex_compile" at module-init time. + (def _force-native-init-before-ffi native-available?) (def c-native-compile (if native-available? (foreign-procedure "jerboa_regex_compile" (u8* size_t u8*) int)