test-extensions-lib.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 1999-2001,2003,2006,2008,2018
  2. Free Software Foundation, Inc.
  3. This file is part of Guile.
  4. Guile is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Lesser General Public License as published
  6. by the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Guile is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  11. License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with Guile. If not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifdef HAVE_CONFIG_H
  16. # include <config.h>
  17. #endif
  18. #include <libguile.h>
  19. SCM init2_count;
  20. #if _WIN32 || __CYGWIN__
  21. #define API __declspec(dllexport)
  22. #else
  23. #define API
  24. #endif
  25. API void libtest_extensions_init2 (void);
  26. API void libtest_extensions_init (void);
  27. void
  28. libtest_extensions_init2 (void)
  29. {
  30. scm_variable_set_x (init2_count,
  31. scm_from_int (scm_to_int (scm_variable_ref (init2_count)) + 1));
  32. }
  33. void
  34. libtest_extensions_init (void)
  35. {
  36. scm_c_define ("init2-count", scm_from_int (0));
  37. init2_count = scm_permanent_object (scm_c_lookup ("init2-count"));
  38. scm_c_register_extension ("libtest-extensions", "libtest_extensions_init2",
  39. (scm_t_extension_init_func)libtest_extensions_init2, NULL);
  40. }