Dangers of using the same GUID in interface definitions?
delphi, guid, interface
Solution
If the same GUID are used not within the same process, this is safe to have the same GUID defined. But if, e.g. you access them via COM, it will definitively be confusing.
If you use diverse interfaces with the same GUID in the same process, e.g. by sharing Delphi code units, you may definitively have issues. By convention, an unique GUID should define an unique signature (i.e. set of methods), so the code may think that a given class instance implements all methods of the interface, and it won't be the case. As a result, the internal execution lookup tables (IMT) won't match. You will get a lot of A/V when calling methods.
Take a look at this very complete article for details about how interfaces work, and what is this internal IMT lookup table. The same GUID would mean the same IMT table, which won't be the case for you, so it will just break at runtime.
Problem
Suppose: 1) HelpfulUserAtSO answers my SO question with a snippet copied from his production code: ``` type IReqBase = Interface(IInterface) ['{B71BD1C3-CE4C-438A-8090-DA6AACF0B3C4}'] procedure FillWithTemplateData; end; ``` 2) I think Great answer! and blindly copy this into my production code. 3a) We both distribute our apps and user X wants to install both executables on his computer. What are the consequences? 3b) I buy up HelpfulUserAtSO's company and want to integrate his code (containing the interface definition) into mine (containing the copy. Assume no scoping conflicts). What are the consequences? After all a GUID should be 'globally unique'...