ctors_fns.c 750 B

1234567891011121314151617181920212223242526
  1. /*
  2. * ctors.c
  3. * Copyright 2019 Peter Jones <pjones@redhat.com>
  4. *
  5. */
  6. #include <efi.h>
  7. #include <efilib.h>
  8. int constructed_value = 0;
  9. static void __attribute__((__constructor__)) EFI_NO_TAIL_CALL ctor(void)
  10. {
  11. Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
  12. constructed_value = 1;
  13. Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
  14. }
  15. static void __attribute__((__destructor__)) EFI_NO_TAIL_CALL dtor(void)
  16. {
  17. Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
  18. constructed_value = 0;
  19. Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
  20. }
  21. // vim:fenc=utf-8:tw=75:noet