main.cpp 916 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "main.h"
  2. #include <stdio.h>
  3. #include <stdarg.h>
  4. #include <mono\jit\jit.h>
  5. #include <mono/metadata/environment.h>
  6. #include <mono/utils/mono-publib.h>
  7. #include <mono/utils/mono-logger.h>
  8. #include <mono/metadata/assembly.h>
  9. #include <mono/metadata/mono-debug.h>
  10. #include <mono/metadata/exception.h>
  11. void(*log)(const char* buf, int len);
  12. void interpreter_log(const char* fmt, ...)
  13. {
  14. if (log == 0)
  15. {
  16. return;
  17. }
  18. char buffer[1024];
  19. va_list argptr;
  20. va_start(argptr, fmt);
  21. int n = vsprintf_s(buffer, fmt, argptr);
  22. va_end(argptr);
  23. log(buffer, n);
  24. }
  25. void interpreter_set_log(void(*plog)(const char* buf, int len))
  26. {
  27. log = plog;
  28. }
  29. void interpreter_init(const char* bundleDir, const char* dllName)
  30. {
  31. mono_set_dirs(bundleDir, bundleDir);
  32. interpreter_log("1111111111111111111111 %s %s", bundleDir, dllName);
  33. //MonoDomain* domain = mono_jit_init(dllName);
  34. }