From: ("Anatol Belski")
Date:  16 Nov 2015 21:22:00 Hong Kong Time

RE: [PHP-DEV] Windows (Visual Studio) compiler stuff

NNTP-Posting-Host:  null

Hello Matt,

> -----Original Message-----
> From: Matt Wilmas []
> Sent: Sunday, November 15, 2015 11:31 PM
> To:;
> Cc: Dmitry Stogov ; Anatol Belski
> Pierre Joye 
> Subject: [PHP-DEV] Windows (Visual Studio) compiler stuff
> Hi Dmitry, Anatol, Pierre (etc.), and all,
> I'm back now, I think, after a much longer (unintentional) break than I
> Be coming very soon with what I was doing in the summer (param parsing
> -- *now* it works with MSVC too, barring any fragility, as I accidentally
> discovered last month...
> I've been "discovering" a lot with the wacky Visual Studio compiler! :-)
> message is about the 2 I found today.
> The first simple thing was probably just overlooked, but noticed it while
> up __declspec.  zend_never_inline has always been empty (I guess) for
> but there's actually a __declspec(noinline) that can be used (and works as
> expected).  A simple and obvious change to bring it in line with the other
> compilers?
According to the docs __declspec(noinline) is specific to C++. Also with VS
it's always much more tedious to inline something than the opposite. These
are the main two reasons it's disregarded ATM. We can add it for compliance
with C++, but it'll in best case have no effect in the PHP core. Should be
tested before, though.

> The second "issue" is with the zend_always_inline functions, I noticed
> summer.  Did anyone else know that MSVC leaves a *copy* of those functions
> the output files (DLLs)?  What's the point of that?  When they've been
> and not referenced otherwise, there should be no reason to emit code for a
> standalone function!
> I remembered after seeing that behavior that a bit of my own
> code did NOT have extra function code, but forgot to investigate until
> What's different about my function definition?  No "static"
> specifier!  So that's the key. :-)
> But... non-static would create duplicate symbols, I thought.  But no, it
> With just __forceinline, there's no errors. :^)
> Can something be done about this?  It would cut the binary size down a
> A zend_static macro to be used with zend_always_inline...?
I'd ask you for some concrete case for this, as I'm not sure to understand
exactly what you mean. The only case where an extra code would be generated
is with "__declspec(export) inline", but that's not the case anywhere within