 
 : com-wrap ( object wrapper -- wrapped-object )
     [ vtbls>> ] [ (malloc-wrapped-object) ] bi
-    [ [ set-void*-nth ] curry each-index ] keep
+    [ over length <direct-void*-array> 0 swap copy ] keep
     [ +wrapped-objects+ get-global set-at ] keep ;

USING: alien alien.c-types windows.com.syntax init
windows.com.syntax.private windows.com continuations kernel
namespaces windows.ole32 libc vocabs assocs accessors arrays
sequences quotations combinators math words compiler.units
destructors fry math.parser generalizations sets ;
IN: windows.com.wrapper

TUPLE: com-wrapper callbacks vtbls disposed ;

: (malloc-wrapped-object) ( wrapper -- wrapped-object )
    vtbls>> length "void*" heap-size *
    [ "ulong" heap-size + malloc ] keep
    [ [ 1 ] 2dip set-alien-unsigned-4 ] [ drop ] 2bi ;

: (callbacks>vtbl) ( callbacks -- vtbl )
    [ execute ] void*-array{ } map-as underlying>> malloc-byte-array ;
