in reply to Re^2: ExtUtils::ParseXS has changed (PREINIT:)
in thread ExtUtils::ParseXS has changed

As I now understand it, it's *all* of the other variables (not just 'pos') that should be declared in PREINIT instead of CODE.

C doesn't allow intermixing of vars declarations and code like Perl and C++. Var declarations can just be placed globally or at the start of the block. PREINIT will be placed before any code. CODE can be preceded by other code. Therefore, declarations must be placed in PREINIT or you must add curlies to CODE.

The PREINIT section of perlxs explains this in more detail and gives example.

Replies are listed 'Best First'.
Re^4: ExtUtils::ParseXS has changed (PREINIT:)
by etj (Priest) on May 26, 2022 at 13:48 UTC
    C99 does in fact allow declarations anywhere.