Strange Uncaught exception on nekovm

I made new library for borderless window.
However, I see strange exceptions with nekovm. If it’s hxcpp windows, it doesn’t happen.

How to see the bug:

  1. Uncomment winutils/example/test/src/[email protected] ( Winutils.SetCheck( …

  2. Build example by neko windows.

  3. Click context menu (1x).

  4. Uncaught exception.

  5. Comment(/* ~ /) [email protected] ( winutils_setcheck(…) { / … */ }

  6. Rebuild. (Run Build.bat & Install.bat)

  7. Step 1 - 4. (Even the function of the blank happens.)

Someone please help me.

Could you post the error message of the uncaught exception?

Someone may recognize it without having to run your project.

If I try now, an error has not happened. Please use [email protected] (SetEnable) instead of [email protected] (SetCheck).

Error Messages:

Build succeeded
Done(0)
haxelib run lime run "project.xml" neko -release
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" neko -release
Called from ? line 1
Called from ApplicationMain.hx line 38
Called from openfl/_legacy/Lib.hx line 130
Called from Main.hx line 38
Called from Winutils.hx line 42
Uncaught exception - [email protected]winutils_setenable
Done(1)

One difference between C++ and Neko, is CFFI on Neko expects to always get a response, even an alloc_null (), from a CFFI function. If you do not return a value, it throws an error.

If you are doing void myFunction (value inputValue) {} you would need to use value myFunction (value inputValue) { return alloc_null (); } instead and this might fix it :slight_smile:

1 Like

Thank you for your replay.

I fix ExternalInterface.cpp. http://pastebin.com/MDhzGdeY
However, I get another error when app’s startup.

Build succeeded
Done(0)
haxelib run lime run "project.xml" neko -release
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" neko -release
Haxe code is missing a call to cpp.Prime.nekoInit().
[email protected]_init
Called from Winutils.hx line 18
Called from Main.hx line 54
Called from Main.hx line 71
Called from ApplicationMain.hx line 203
Called from ApplicationMain.hx line 203
Called from C:\HaxeToolkit\haxe\std/neko/_std/Type.hx line 108
Called from ApplicationMain.hx line 105
Called from openfl/_legacy/Lib.hx line 122
Done(1)

Are you using Lime legacy, or Lime 2? Is there a chance you are calling your CFFI functions from Haxe before Lime has been called?

I using Lime legacy.
I try with Lime2. I get another error when startup.

Haxe code is missing a call to cpp.Prime.nekoInit().
Called from ? line 1
Called from ApplicationMain.hx line 123
Called from ApplicationMain.hx line 30
Called from lime/app/Preloader.hx line 61
Called from openfl/display/Preloader.hx line 93
Called from NMEPreloader.hx line 107
Called from openfl/display/DisplayObject.hx line 796
Called from openfl/events/EventDispatcher.hx line 292
Called from openfl/display/Preloader.hx line 129
Called from lime/app/Preloader.hx line 234
Called from ApplicationMain.hx line 86
Called from ApplicationMain.hx line 153
Called from C:\HaxeToolkit\haxe\std/neko/_std/Type.hx line 108
Called from ApplicationMain.hx line 184
Called from ApplicationMain.hx line 211
Called from Main.hx line 71
Called from Main.hx line 54
Called from Winutils.hx line 18
Uncaught exception - [email protected]_init
AL lib: (EE) alc_cleanup: 1 device not closed

Seeing the error you should probably try adding

#if neko
cpp.Prime.nekoInit();
#end

before using your library.

1 Like

I add it to [email protected] Worked fine with lime legacy! :smile:
However, I get another error with lime2 (not legacy) when app’s exit.

Build succeeded
Done(0)
haxelib run lime run "project.xml" neko -release
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" neko -release
AL lib: (EE) alc_cleanup: 1 device not closed
Done(0)

It’s a warning not an error, saying that the audio device wasn’t properly closed.
How do you exit your application? Lime needs to do some clean up before exiting.

Right click in Taskbar -> Close (WM_CLOSE).