Skip to content

Commit d4c642b

Browse files
jappeace-slothclaude
andcommitted
Use weak symbol for haskellUseScrollDemo in jni_bridge.c
The useScrollDemo JNI method was added as test infrastructure for the ScrollView integration tests. It calls haskellUseScrollDemo(), which was declared extern — forcing every app using haskell-mobile as a library to export that symbol from Haskell. Apps that replace HaskellMobile/App.hs (via extraModuleCopy) and don't provide a scroll demo would get an UnsatisfiedLinkError at startup when Android's linker tried to load libprrrrrrrrr.so. Fix: define haskellUseScrollDemo with __attribute__((weak)) so it acts as a no-op fallback. Apps that do want scroll-demo behaviour can override it with a 'foreign export ccall haskellUseScrollDemo' in their Haskell source; apps that don't need it link cleanly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0dd6fa8 commit d4c642b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎cbits/jni_bridge.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ extern void haskellOnLifecycle(void *ctx, int eventType);
2424
extern void haskellRenderUI(void *ctx);
2525
extern void haskellOnUIEvent(void *ctx, int callbackId);
2626
extern void haskellOnUITextChange(void *ctx, int callbackId, const char *text);
27-
extern void haskellUseScrollDemo(void);
27+
28+
/* Weak default for apps that don't provide a scroll-demo.
29+
* Apps that want useScrollDemo to do something meaningful should define
30+
* haskellUseScrollDemo via 'foreign export ccall' in their Haskell source,
31+
* which overrides this no-op at link time. */
32+
void __attribute__((weak)) haskellUseScrollDemo(void) {}
2833

2934
/* Android UI bridge (from ui_bridge_android.c) */
3035
extern void setup_android_ui_bridge(JNIEnv *env, jobject activity, void *haskellCtx);

0 commit comments

Comments
 (0)