_NonAppCheckUnload

Is a prototype for a call-back function that determines whether an NLM™ should allow itself to be unloaded.

Library:LibC
Classification:Novell®
Service:NetWare Platform

Syntax

  #include <netware.h> 
   
  int _NonAppCheckUnload (void);
  

Return Values

If the NLM can be safely unloaded, returns 0; otherwise returns a nonzero value that causes the loader to issue a message that the NLM cannot be unloaded.

Remarks

The _NonAppCheckUnload function is coded as a Loader call-back that the developer supplies. It is not exported by any library on NetWare and is only called if you link with libcpre object file.

NOTE:This function is not used to clean up resources. For this functionality, see _NonAppStop.

This call-back function allows the NLM to determine whether to permit itself to be unloaded or not. It is called when the unload command is typed at the console or an NLM unload request is made in some other fashion. The call-back function should generally consider printing some explanation on the System Console before returning nonzero.

You should specify _LibCCheckUnload to the linker via the CHECK option.

When writing a check-unload function, remember the following guidelines:

  • The loader should be able to unload an NLM except for a small number of reasonable exceptions.

  • You should use the OutputToScreen or consoleprintf function to print a message to the NetWare Console Logger screen, to explain why the NLM cannot be unloaded.

  • Although your check-unload function can call other LibC functions, you must ensure that it does not call a blocking function. Some functions obviously perform blocking operations, such as acquiring a mutex or performing file I/O (opening, reading, or writing). Others are not so obvious.

  • Because the check-unload function is an optional function, do not code the function with a code offset of 0. The 0 offset is ambiguous with not having a check-unload function. Because the first function in the first file specified to the linker can be given an offset of 0, make sure the check-unload function is not in that location.

See Also