i'm thinking about this problem since some days. when i'm writing reusable code in pbi-files, each file has to contain structures, interfaces, constants ... are needed to run code.
to use
Defined(Name, Typ) is bull sh..., because when there is a different structure/interface with the same name in a other pbi-file, you will have large problems and it can be very hard to find the bug. on the other side, what is the same function? are this both interfaces the same or not?
Code: Select all
Interface XYZ
Test (*X)
EndInterface
Code: Select all
Interface XYZ
Test (*X.IUnknown)
EndInterface
for iid's i'm using the following code:
Code: Select all
CompilerIf Defined (IID_IUnknown, #PB_Constant) = #False
IID_IUnknown:
Data.l $00000000
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
CompilerEndIf
#IID_IUnknown = "00000000-0000-0000-C000-000000000046"
in this case, the compiler has no problems, when the iid is already defined in a other pbi-file. additionally i can be sure, that the value of the iid is the same as in the other pbi-file.
i havn't tested, but maybe i will use the same system for structures/interfaces. i will make a little program, that's making a simple hashvalue from the structures/interfacetext. when i'm using this hashvalue in the constant, i can be sure, that the structure/interface is the same.
but this workaround doesn't help you with predefined structures/interfaces. so we have to wait for a native solution.