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

add support for MinGW32 compiler #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PiecePaperCode
Copy link

When cross compiling gamespy on MinGW32 a issue is encountered

gt2encode.c

src/gt2/gt2encode.c:114:36: error: lvalue required as unary ‘&’ operand
  114 |         gt2MemCopy(b, (const char*)&va_arg(*args, TYPE), sizeof(TYPE));    

gsplatformutil.c

src/common/gsplatformutil.c:1709:19: error: ‘LARGE_INTEGER’ has no member named ‘LowPart’
 1709 |         seed = (l1.LowPart ^ l1.HighPart);

Changes

Add makro dedection for MinGW compiler.

Vision

This is work for the ability to crosscompile ZH from linux to windows and in the future produce a native binary aswell.

Signed-off-by: Marcos Gamez <[email protected]>
@@ -1706,7 +1706,11 @@ static void GenerateID(char* keyval)
LARGE_INTEGER l1;
UINT seed;
if (QueryPerformanceCounter(&l1))
#ifdef __MINGW32__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't gate this change behind just mingw, it should work for msvc as well.

{ \
if (l < sizeof(TYPE)) \
return -1; \
TYPE temp = va_arg(*args, TYPE); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again no need to gate this behind mingw, but it would need fixing to C89 standards, so TYPE temp; needs to go at the top of the scope. A better fix is just to add || defined(__MINGW32__) next to the || defined(_X360) above IMO though as it seems MINGW should take the same path as the _UNIX define does.

Copy link
Contributor

@OmniBlade OmniBlade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the ifdef for mingw as described?

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.

None yet

2 participants