The overview of an extension is quite simple. It consists of the following elements:
Any required headers including the necessary Perl headers
Any required non-Perl functions
Any Perl functions that require the use of the XS() macro
The Perl bootstrap function
Optionally, the Windows DllMain() function
The very first thing you should do in your extension source file is include the headers. Some Perl headers are required and need to be included. In Example 10.14, line 14 declares that lines 14 to 22 are to be compiled as regular C and not as C++ (by using extern "C"). Otherwise, you will see some pretty nasty function name mangling, which can be the cause of many frustrated debugging sessions. This is only necessary if you ...