How to operate Sentry_init() in DllMain() (C++)

BOOL APIENTRY DllMain(HMODULE hModule,
    DWORD  ul_reason_for_call,
    LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
        {
            g_hInstance = (HINSTANCE)hModule;

            MessageBox(NULL, TEXT("!!!"), TEXT("thread"), MB_OK);

            MessageBox(NULL, TEXT("abcdefg"), TEXT("fail"), MB_OK);
            sentry_options_t* options = sentry_options_new();
            sentry_options_set_dsn(options, "mydsn");
            sentry_options_set_release(options, "");
            sentry_options_set_debug(options, 1);
            sentry_options_set_max_breadcrumbs(options, 100);
            sentry_options_set_handler_path(options, "/sentry/crashpad_handler.exe");
            sentry_options_set_environment(options, "DEBUG");

            sentry_value_t exc = sentry_value_new_object();
            sentry_value_set_by_key(exc, "type", sentry_value_new_string("Report"));

            sentry_value_t event = sentry_value_new_event();
            sentry_value_set_by_key(event, "exception", exc);
            sentry_event_value_add_stacktrace(event, nullptr, 0);
        
            sentry_init(options);

            break;
        }

        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

However, when sentry_init(options) is called, the program stops, like a deadlock.

How can I fix it?

If sentry_init(options) is not exist, program run successfully.