//Sample code file: var/ndk/webBuildengine/tmp/viewable_samples/7999585e-fdab-4e7b-b86c-67d55e862138/nks/Wrap.c

//Warning: This code has been marked up for HTML

/***************************************************************************
$name: Wrap.c 
$version: 1.0 
$date_modified: 120402 
$description: Demonstrates creating contexts, threads and yielding.
$owner: NKS Product Manager 
Copyright (c) 2002 Novell, Inc. All Rights Reserved.

THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT
ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK.
PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A
ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS
PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET,
DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S
PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S
CUSTOMERS WITH RESPECT TO THIS CODE.
****************************************************************************/
#include <nks/netware.h>

void   *gCBFRef = (void *) NULL;

static int   CallBackFuncThatDoesSomething( int arg1, double arg2 );

static int CallBackFuncThatDoesSomething( int arg1, double arg2 )
{
   // do stuff here after getting called back by whatever service you've

   // registered with

   // . . .

   return 0;
}

void InitializeFunction( void )
{
   int   err;

   // . . .


/*
** Code where you give the service with which you register your call-back
** pointer, in this case, to CallBackFuncThatDoesSomething, which takes 3
** stack words.
*/
   err = NX_WRAP_INTERFACE(CallBackFuncThatDoesSomething, 3, &gCBFRef);

   // . . .

}

void CleanUpFunction( void )
{
/*
** Code where you are shutting down and know that this func won't get called
** again.
*/
   // . . .


   if (gCBFRef)
      NX_UNWRAP_INTERFACE(gCBFRef);

   // . . .

}