||SQL Server Tips by Gama and Naughter
To create an XP that does something useful, an XP must link to the
ODS DLL “Opends60.lib”. This DLL exposes the ODS API that SQL Server
uses to communicate with your XP and vice versa.
What follows is a simplified description of the functions which this
DLL exposes and which your XP can call to perform its work. It
describes the basic functionality exposed by each function, meaning
that you should refer to the MSDN documentation for detailed
information on the flags and parameters available. The discussion
only covers the functions that are used for XP's and which are fully
supported In SQL Server 2000.
Most of the functions exposed by this DLL take a SRV_PROC pointer.
This should be the same value, which is passed to your XP’s main
function. This pointer is called a “connection handle” and is an
opaque data structure that SQL Server uses to communicate
information between itself and your XP. This structure is not
documented in any ODS header file, and just like a HANDLE in Win32
programming, it should be treated as opaque. We can well imagine
that any ODS functions which takes a SRV_PROC parameter will
internally query this structure in some way and return results back
to us in our XP.
The above book excerpt is from:
Turbocharge Database Performance with C++ External Procedures
Joseph Gama, P. J. Naughter