alloc_bool, val_true and val_false throw exceptions in external interface

56 views
Skip to first unread message

TopHattedCoder

unread,
Aug 28, 2013, 8:05:47 PM8/28/13
to haxe...@googlegroups.com
Hi guys,
I'm trying to implement support for returning a bool from a HxJIT function. The reference for jit_function_apply.
if(ret == jit_type_sys_bool) {
    uint8_t result
;
    jit_function_apply
(func, fargs, &result);
   
return alloc_bool(result != 0);
}
This causes Haxe/Neko to throw an exception. Implemented with an int, however:
if(ret == jit_type_sys_bool) {
    uint8_t result
;
    jit_function_apply
(func, fargs, &result);
   
return alloc_int(result != 0);
}
With some Haxe wrapping works.

Hugh

unread,
Aug 29, 2013, 1:16:12 AM8/29/13
to haxe...@googlegroups.com
Hi,

These values come from "neko_init", which must booted from your haxe code before making these calls.
This function is generated in the CFFILoader header.

Here is the code nme uses to boot it:


#if neko
public static function loadNekoAPI()
{
     var init = load("neko_init", 5);

    if (init != null) 
    {
      loaderTrace("Found nekoapi @ " + moduleName);
      init(function(s) return new String(s), function(len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false);
    }
   else
      throw("Could not find NekoAPI interface.");
}
#end


Hugh

TopHattedCoder

unread,
Aug 29, 2013, 8:40:19 AM8/29/13
to haxe...@googlegroups.com
Thanks.
Reply all
Reply to author
Forward
0 new messages