[vlc-devel] [PATCH] npapi: Changed files to be compilable by VC.

Sergey Radionov rsatom at gmail.com
Mon Nov 21 06:37:11 CET 2011

21.11.2011 10:42, Rafaël Carré пишет:
> Le Mon, 21 Nov 2011 10:03:39 +0700,
> Sergey Radionov<rsatom at gmail.com>  a écrit :
>> btw, I think macros HAVE_CONFIG_H not needed anymore, at least to me...
> Yes it was never needed.
> config.h is always present in the source.
> We use it in VLC because files can be built outside of VLC build dir.
> Some questions:
> - Can you comment on npolibvlc.cpp change?
+#ifdef _MSC_VER
+const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
+    ""
+const int LibvlcDeinterlaceNPObject::propertyCount=0;
  const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
  enum LibvlcDeinterlaceNPObjectPropertyIds {
+#endif //_MSC_VER

problem is that VC not able create zero length arrays.
so we need create array with some dummy item (it can be any string, including zero lengh string, or 
simply NULL, it does not matter), but propertyCount set to 0, to satisfy original logic.

anticipating you next question, I say  that we must define propertyNames and propertyCount, as 
LibvlcDeinterlaceNPObject used in templates that need it.

> - mingw-w64 also includes npapi.h (I guess mingw32 is just broken), but
> gcc fetches npapi.h from the correct path if we give it with -I

In visual studio (at least in VS2008 and early), paths to libs usially not defined directly in 
solution, but it defines in IDE. But IDE already have path to Windows SDK in the first place, so 
SDK's npapi.h founded first. But we can't move gecko sdk to first place in IDE, as then we can broke 
compilation of other projects than include npapi.h from Windows SDK.
So we need include some header with unique name, that include npapi.h by self.

> - why do you need config.h at all? It only contains the const or not
> const prefix for the function which recently changed prototype.
In VS solution I make substitution of original config.h by my own config.h, which now is:

//config.h begin
#pragma once
#define snprintf _snprintf
#define strcasecmp _stricmp

/* Wether NPP_GetMIMEDescription returns const */
#define NPP_GET_MIME_CONST const
//config.h end

> -

With best wishes,
Sergey Radionov

More information about the vlc-devel mailing list