interposed.c 563 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright 2017-2022 Yury Gribov
  3. *
  4. * The MIT License (MIT)
  5. *
  6. * Use of this source code is governed by MIT license that can be
  7. * found in the LICENSE.txt file.
  8. */
  9. #include <stdio.h>
  10. #include "interposed.h"
  11. __attribute__((visibility("default")))
  12. int foo(int x, float y) {
  13. printf("Calling foo from libtest: %d %g\n", x, y);
  14. return 0xf00;
  15. }
  16. __attribute__((visibility("default")))
  17. int bar(int x, int y, int z) {
  18. printf("Calling bar from libtest: %d %d %d\n", x, y, z);
  19. return 0xba7;
  20. }
  21. __attribute__((constructor))
  22. void dummy() {
  23. foo(1, 1);
  24. }