Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows x86 discord integration #6893

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Conversation

obligaron
Copy link
Contributor

This PR fixes the Discord integration on MSVC on x86.

In devilutionX we are applying some patches to the Discord sdk to fix various issues:

1. Replaces `#include <Windows.h>` with `#include <windows.h>`
   for compatibility with case-sensitive file systems (e.g. MinGW
   cross-compilation on a Linux host).
2. Adds missing `#include <cstdint>` to `cpp/types.h`.
3. Fixes calling convention for callback lambdas.

The last point (fixing calling convention) breaks MSVC x86 builds.

error C2760: syntax error: '__stdcall' was unexpected here; expected '{'

The applied fix adds DISCORD_CALLBACK to lambdas.
DISCORD_CALLBACK is defined as

#ifdef _WIN32
#ifdef _WIN64
#define DISCORD_API
#else
#define DISCORD_API __stdcall
#endif
#else
#define DISCORD_API
#endif

#define DISCORD_CALLBACK DISCORD_API

So it's only set on Windows x86 builds. That's why x64 builds work on MSVC.

The devilutionX fixes are not needed on Windows and MSVC. So this PR disables them altogether when using MSVC.

I'm open to better fixes. 😉

@AJenbo AJenbo merged commit 607737e into diasurgical:master Jan 10, 2024
23 checks passed
@obligaron obligaron deleted the discordx86 branch January 10, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants