I would not include the whole list all the time, as then all the imported GUIDs will
get linked even if not used in the code. (just check the exe size,
its about 50k larger with the full list compared to a single import)
A nice little macro can be helpful here:
Code: Select all
Macro ImportGUID(name)
CompilerIf Defined(name, #PB_Variable) = 0
Import "uuid.lib"
name
EndImport
CompilerEndIf
EndMacro
ImportGUID(IID_IXMLElementCollection)
x = @IID_IXMLElementCollection
With the compilerif, even multiple use with the same name is no error.
To further the number of possibilities, here are two ways from me to define
such values (in case one is not contained in the above list):
There is my GUIDViewer tool that exist since a while that has all the GUIDs from
the MS headers and generates the PB datasections:
http://freak.purearea.net/tools/GuidViewer.zip
My prefered way however is included in my COM Framework (here:
http://freak.purearea.net/tools/ComFramework.zip)
It includes a resident called "GuidList.res", which contains a macro to
automatically define the GUIDs from the GUIDViewer tool.
There you can just do this and it automatically inserts the needed datasection:
Code: Select all
DefineKnownGuid(IID_IXMLElementCollection)
x = ?IID_IXMLElementCollection
So... do you still think a spechial compiler feature is needed for this ?
