Beginning Your Extension

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 ...

Get Win32 Perl Programming: The Standard Extensions, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.