> On Dec 14, 2017, at 12:59 AM, krishnaLee <[email protected]> wrote:
> 
> Hello,
> I am learning and writing a application to change the Nt32pkg-virtual 
> machine's boot time.follow code is success.
> but I think if I using PcdGetEx16 function, it will also work well,but failed 
> when I compile it.
> I had read some Specs about the difference between PcdGetEx and PcdGet,but I 
> can't understand,maybe I need some practice,
> So can anyone modify it to using PcdGetEx to implement the same function in 
> the application?
> //source-code--start

Did you add:

#include <Guid/MdePkgTokenSpace.h>

and list gEfiMdePkgTokenSpaceGuid in the [Guids] section of the INF. 

In general it is hard to comment on compiler failures in fragments of code. If 
you post the actual compiler error it is easier to explain. 



The PCDs are a GUID + token number namespace for config. Since anyone can 
define a GUID that does not conflict it allows arbitrary extension without 
conflict. 

The Ex form of the API includes the GUID + token number. The non Ex form is a 
size optimization that uses a build generated token space. So generally if 
everything is built together then you use the non Ex form to save space. If 
different binaries that got compiled in different places need to work together 
then the Ex form is required. 

Thanks,

Andrew Fish

> EFI_STATUS
> EFIAPI
> UefiMain (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> UINTN buffer=0;
> UINTN index;
> buffer=PcdGet16(PcdPlatformBootTimeOut);
> //buffer=PcdGetEx16(&gEfiMdePkgTokenSpaceGuid,PcdPlatformBootTimeOut);//compile
>  failed.
> Print(L"buffer:%d\n",buffer);
> PcdSet16(PcdPlatformBootTimeOut,5);
> ...
> 
> 
> //source-code-end.
> 
> 
> attachment is the full source code.
> edk2-vUDK2017's build command:
> build -p Nt32Pkg\Nt32Pkg.dsc -m Nt32Pkg\Application\mytestpcd2\mytestpcd2.inf
> 
> 
> thank you very much!
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected] <mailto:[email protected]>
> https://lists.01.org/mailman/listinfo/edk2-devel 
> <https://lists.01.org/mailman/listinfo/edk2-devel>
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to