My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 149: Cffi, NEKO_COMPATIBLE and alloc_null()
1 person starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  Dec 2011


 
Reported by waneck, Oct 23, 2011
Compile with NEKO_COMPATIBLE the following code:

value test_cffi()
{
    return alloc_null();
}

DEFINE_PRIM(test_cffi, 0);


it runs fine on hxcpp, but on neko it fails.  alloc_null()  should return in a neko context not NULL, but neko's null value.
Dec 15, 2011
Project Member #1 gameh...@gmail.com
Hi,
You need to call the following code from your library - nice and early before the values are actually required:

      #if neko
      public static function loadNekoAPI()
      {
         var init =  load("neko_init", 5);
         if (init != null)
         {
            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

This is not properly documented - sorry about that one.
Status: WontFix

Powered by Google Project Hosting