Skip to content

Commit

Permalink
Add support for building with MSVC for x64 Windows (#33)
Browse files Browse the repository at this point in the history
* Make lglob not crash when it's built with MSVC x64

The return type of _findfirst is intptr_t. When the target is x64,
intptr_t is 64-bit, while long is 32-bit, so using long truncates
the result.

* Makefile.wnm: don't hardcode the I386 machine type

This allows building for either I386 or x64 with the same makefile,
by running it in the appropriate environment.
  • Loading branch information
SpecLad authored and gwsw committed Nov 23, 2019
1 parent 4b7b8d8 commit 0713eaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile.wnm
Expand Up @@ -7,11 +7,11 @@ CC = cl

# Normal flags
CFLAGS = /nologo /MD /W3 /EHsc /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
LDFLAGS = /nologo /subsystem:console /incremental:no

# Debugging flags
#CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:I386
#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug

LD = link
LIBS = user32.lib
Expand Down
2 changes: 1 addition & 1 deletion lglob.h
Expand Up @@ -62,7 +62,7 @@
char dir[_MAX_DIR]; \
char fname[_MAX_FNAME]; \
char ext[_MAX_EXT]; \
long handle;
intptr_t handle;

#else
#if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) /* Borland C for Windows */
Expand Down

0 comments on commit 0713eaf

Please sign in to comment.