O'Reilly logo

Win32 Perl Programming: The Standard Extensions, Second Edition by Dave Roth

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required