0

I am new to UEFI (Unified Extensible Firmware Interface) development. And I am using the EDK (EFI Development Kit).

To create a new protocol, we need to give the protocol a GUID. For example, in the header file for BlockIO protocol, we can see this:

(MdePkg\Include\BlockIo.h)

The macro: enter image description here

The global variable:

enter image description here

And in the package declaration file MdePkg.dec:

enter image description here

Why do we need 3 of these to give a protocol a GUID?

(Maybe this question is related to C language specifics, so I add the c and macros tags, too.)

smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 1
    I believe it's just for clarity. Define shows you what the actual GUID value assigned and you don't have to go to UEFI Protocol manual/doc to see what GUID is assigned to that protocol. If you need to know it for some reason. External variable is declared in h-file but initialized/assigned in c-file. For example, In my case, I have only headers and no source but I can see the actual GUID right where the global external variable is declared. – Alex D Aug 23 '15 at 07:43

1 Answers1

0

The global variable can be used only by drivers that link against the object where it is defined (BlockIo.c in your case). I think the macro is defined in the header file so that drivers that don't link with that object can use the GUID from the macro.

haggai_e
  • 4,689
  • 1
  • 24
  • 37