mb_push_handle

Previous  Next

 

status_t mb_push_handle( mb_interpreter_t* s, void** l, handle_t val )

 


 

Pushes a function return value of type HANDLE to the interpreter.

 

Example

 

/////////////////////////////////////////////////////////////////////////////

// handle = sm.create( "name", sizeKB )

//

int mb_ext_sm_create( mb_interpreter_t* s, void** l )

  {

  AFX_MANAGE_STATE( AfxGetStaticModuleState() );

  //////////////////////////////////////////////////////////////////////////

 

  BEGIN_PARSE( s, l )

     POP_STRING( pName )

     POP_INT( nSize )

  END_PARSE

 

  CSharedMemory* pSM = new CSharedMemory( pName, nSize * 1024 );

 

  handle_t hHandle = 0;

 

  if ( pSM && pSM->IsCreated() )

     {

     hHandle = pSM;

     }

  else

     {

     delete pSM;

     }

  endif

 

  mb_check( mb_push_handle( s, l, hHandle ) );

 

  return MB_FUNC_OK;

  }

endfunc