ruby - How do I wrap a C function and pass it parameters? -


i have wrap c function abc_ntkcreatenodeand using ruby:

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 );      ( = 0; < vfanins->nsize; i++ )     abc_objaddfanin( pnode, (abc_obj_t *)vfanins->parray[i] );     if ( abc_ntkhassop(pntk) )       pnode->pdata = abc_sopcreateand( (mem_flex_t *)pntk->pmanfunc, vec_ptrsize(vfanins), null );     else if ( abc_ntkhasbdd(pntk) )       pnode->pdata = extra_bddcreateand( (ddmanager *)pntk->pmanfunc, vec_ptrsize(vfanins) ), cudd_ref((ddnode *)pnode->pdata);      else if ( abc_ntkhasaig(pntk) )       pnode->pdata = hop_createand( (hop_man_t *)pntk->pmanfunc, vec_ptrsize(vfanins) );      else       assert( 0 );   return pnode; } 

the code wrote is:

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); } 

i want pass arguments using ruby , directly call c function. possible so?


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -