yglukhov / jnim

Nim - Java bridge
MIT License
184 stars 13 forks source link

Fix for building on modern compiler versions. #74

Closed Q-Master closed 1 year ago

Q-Master commented 1 year ago

Fixed working with nimx and android. Removed some warnings

yglukhov commented 1 year ago

Please see alternative fix in #75. Your PR has some convoluted changes I don't understand.

Q-Master commented 1 year ago

The #75 fix is not fixing this:

~/.nimble/pkgs/jnim-0.5.3/jnim/private/jni_api.nim(197, 6) Warning: 'findClass' is not GC-safe as it calls 'findClassOverride' [GcUnsafe2]
~/.nimble/pkgs/jnim-0.5.3/jnim/private/jni_api.nim(203, 6) Warning: 'getByFqcn' is not GC-safe as it calls 'findClass' [GcUnsafe2]
~/.nimble/pkgs/android-0.2.0/android/app/activity.nim(21, 6) Warning: 'getSDLMainActivity' is not GC-safe as it calls 'getByFqcn' [GcUnsafe2]
~/.nimble/pkgs/android-0.2.0/android/app/activity.nim(28, 6) Warning: 'currentActivityIfPresent' is not GC-safe as it calls 'getSDLMainActivity' [GcUnsafe2]
~/.nimble/pkgs/android-0.2.0/android/app/activity.nim(33, 6) Warning: 'currentActivity' is not GC-safe as it calls 'currentActivityIfPresent' [GcUnsafe2]
~/Work/Own/Nim/nimx/nimx/screen.nim(14, 6) Warning: 'screenScaleFactor' is not GC-safe as it calls 'currentActivity' [GcUnsafe2]
~/Work/Own/Nim/nimx/nimx/private/windows/sdl_window.nim(158, 6) Warning: 'scaleFactor' is not GC-safe as it calls 'screenScaleFactor' [GcUnsafe2]
~/Work/Own/Nim/nimx/nimx/private/windows/sdl_window.nim(185, 6) Warning: 'updatePixelRatio' is not GC-safe as it calls 'scaleFactor' [GcUnsafe2]
~/Work/Own/Nim/nimx/nimx/private/windows/sdl_window.nim(193, 6) Warning: 'initSdlWindow' is not GC-safe as it calls 'updatePixelRatio' [GcUnsafe2]
~/Work/Own/Nim/nimx/nimx/private/windows/sdl_window.nim(222, 8) Error: 'init' is not GC-safe as it calls 'initSdlWindow'

mine version fixes all that unsafes completely.

Q-Master commented 1 year ago

Seems that the problem is in findClassOverride itself. Yes. Marking the findClassOverride gcsafe completely fixes the problem. Review the fix plz.

yglukhov commented 1 year ago

perfect, thanks!