DllMain.cpp 691 B

1234567891011121314151617181920212223242526272829
  1. #include "il2cpp-config.h"
  2. #if IL2CPP_TARGET_WINDOWS && !RUNTIME_TINY
  3. #include "DllMain.h"
  4. #include "ThreadImpl.h"
  5. #include "WindowsHeaders.h"
  6. BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved)
  7. {
  8. if (reason == DLL_THREAD_DETACH)
  9. il2cpp::os::ThreadImpl::OnCurrentThreadExiting();
  10. return TRUE;
  11. }
  12. #if LIBIL2CPP_IS_IN_EXECUTABLE
  13. typedef BOOL(WINAPI* DllMainFunc)(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved);
  14. __declspec(dllimport) extern void Libil2cppLackeySetDllMain(DllMainFunc dllMain);
  15. #endif
  16. void il2cpp::os::InitializeDllMain()
  17. {
  18. #if LIBIL2CPP_IS_IN_EXECUTABLE && !IL2CPP_TINY
  19. Libil2cppLackeySetDllMain(DllMain);
  20. #endif
  21. }
  22. #endif