title: How do I wrap a C function and pass it parameters?
body: <p>I have to wrap this C function <code>Abc_NtkCreateNodeAnd</code> using Ruby:</p>
  
  <pre><code>Abc_Obj_t * Abc_NtkCreateNodeAnd( Abc_Ntk_t * pNtk, Vec_Ptr_t * vFanins )
  {
    Abc_Obj_t * pNode;
    int i;
    assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
    pNode = Abc_NtkCreateNode( pNtk );   
    for ( i = 0; i &lt; vFanins-&gt;nSize; i++ )
      Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins-&gt;pArray[i] );
      if ( Abc_NtkHasSop(pNtk) )
        pNode-&gt;pData = Abc_SopCreateAnd( (Mem_Flex_t *)pNtk-&gt;pManFunc, Vec_PtrSize(vFanins), NULL );
      else if ( Abc_NtkHasBdd(pNtk) )
        pNode-&gt;pData = Extra_bddCreateAnd( (DdManager *)pNtk-&gt;pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode-&gt;pData); 
      else if ( Abc_NtkHasAig(pNtk) )
        pNode-&gt;pData = Hop_CreateAnd( (Hop_Man_t *)pNtk-&gt;pManFunc, Vec_PtrSize(vFanins) ); 
      else
        assert( 0 );
    return pNode;
  }
  </code></pre>
  
  <p>The code I wrote is: </p>
  
  <pre><code>static VALUE Abc_NtkCreateNode_And(VALUE self, VALUE netw ,VALUE vfan_ins)
  {
    Abc_Ntk_t *netw_str;
    Vec_Ptr_t *vfan_ins_str;
    Data_Get_Struct(netw, Abc_Ntk_t, netw_str);
    Data_Get_Struct(vfan_ins, Abc_Ntk_t, vfan_ins_str );
    Abc_Obj_t *network = Abc_NtkCreateNodeAnd(netw_str,vfan_ins_str);
    return make_Network(network);
  }
  </code></pre>
  
  <p>I want to pass the arguments using Ruby and directly call the C function. Is it possible to do so?</p>