[vlc-devel] [PATCH] npapi: Changed files to be compilable by VC.
Sergey Radionov
rsatom at gmail.com
Mon Nov 21 08:29:24 CET 2011
21.11.2011 13:26, Rafaël Carré пишет:
>> +#ifdef _MSC_VER
>> +const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
>> + ""
>> +};
>> +const int LibvlcDeinterlaceNPObject::propertyCount=0;
>> +#else
>> const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
>> };
>> enum LibvlcDeinterlaceNPObjectPropertyIds {
>> };
>> COUNTNAMES(LibvlcDeinterlaceNPObject,propertyCount,propertyNames);
>> +#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.
>
> Ok, if a dummy array works, we might as well use it in all cases to avoid #ifdef hell
but what about COUNTNAMES macro? if array will have dummy item, then it return 1, instead of 0...
> Just add a comment saying why we do that.
> e.g. // MSVC++ doesn't support zero length arrays, as of version XXXX
>
>>> - 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.
>
> Ha I see npfunctions has a #include "" and not<>
I think it is only mistyping, but I am not shure, thats why I am not fix it.
>
> Same than above, just use npfunctions everywhere with
> // Include npfunctions to avoid including Windows' own npapi.h
>
>>> - 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:
>
> Hm right you had explained that already sorry.
>
> You could add -Dsnprintf=_snprintf and likes to the VC project but if we need more config
> options it will soon get very long so I am not sure what's the best to do.
No, I can't. There are too many versions of Visual Stuio, and each of could have there own
solution/project/workspace. So, I think the best way is to have single config.h than multiple
definitions in different places.
>
>> //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