This week we conclude our series of articles by point out how to use the C/C++ libraries with your driver:
1. Change Your INF Entry Point. Each INF file has an IMAGE_ENTRY_POINT= statement. Change it to one of the following:
|
EXE Type |
IMAGE_ENTRY_POINT |
main() Prototype |
|
PEI Module |
PeiMainStartup |
EXTERN_C EFI_STATUS EFIAPI PeiMain( IN EFI_FFS_FILE_HEADER* FileHeader, IN EFI_PEI_SERVICES** PeiServices ); |
|
DXE Boot Services Driver |
DxeMainBSStartup |
EXTERN_C EFI_STATUS EFIAPI DxeMain( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); |
|
DXE Runtime Services Driver |
DxeMainRTStartup |
EXTERN_C EFI_STATUS EFIAPI DxeMain( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); |
|
SMM |
SmmStartup |
EXTERN_C EFI_STATUS EFIAPI SmmMain( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); |
|
EFI Shell |
mainCRTStartup |
EXTERN_C int EFIAPI main( IN int argc, IN char*argv[] ); |
2. Change Your INF [include.common].
Add "$(EFI_SOURCE)\phoenix\features\clibrary\include" to the [include.common] section.
3. Change Your INF [libraries.common].
Add libc.lib to the [libraries.common] section.
4. Add Libraries To Your DSC.
Add this line to the 32-bit and 64-bit sections of the [libraries.platform] section of the build.dsc file.
$(EFI_SOURCE)\phoenix\Features\Clibrary\bin\$(PROCESSOR)\libc.inf



Comments