Hi Nicolas,

i seem to have hit another problem, cannot quite explain. It seems to occur 
when i pass the return code of a PRIM_MULT function thru some other function. 
Well, let the code speak:

this is the (very simple) c primitive:

  static value test_arguments( value *args, int nargs ) {
        return( alloc_int(23) );
  }
  DEFINE_PRIM_MULT( test_arguments );


i loadprim with -1 arguments, is that correct?:

class Test {
        public static var _test = neko.Lib.load("test","test_arguments",-1);
        
        static function test( a1:Int, a2:Int, a3:Int, a4:Int, a5:Int, a6:Int ) 
:Int {
                return _test(a1,a2,a3,a4,a5,a6);
        }
        
        static function test_trace() {
                // this works fine: Test.hx:10: 23
                trace( test( 1, 1, 1, 1, 1, 1 ) );
        }

        static function print( a:Int, b:Int ) :Void {
                /* this fails, i get:
                        Test.hx:17: { __name__ => [Test], main => #function:0, 
print => #function:2, test => #function:6, prototype => { __class__ => ..., 
__serialize => #function:0 }, test_result => #function:0, test_trace => 
#function:0, _test => #function:-1 } == 23? false            
                */
                trace( ""+a+" == "+b+"? "+(a==b) );
        }
        static function test_result() {
                print( 23, test( 1, 1, 1, 1, 1, 1 ) );
        }

        static function main() {
                test_trace();
                test_result();
        }
}


the "a" argument to the print function seems to get corrupted by the test() 
call. i can only assume something is going fishy in the dark realms of nekovm? 
this only happens with DEFINE_PRIM_MULT functions.

-dan

-- 
http://0xDF.com/
http://iterative.org/

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to