Skip to content

Commit

Permalink
Move MSVC build to standard stdbool.h and require Visual C++ 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblaesing committed Jan 19, 2017
1 parent bfa5f94 commit b37a652
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Features

Bug Fixes
---------
* [#754](https://github.com/java-native-access/jna/issues/754): Move MSVC build to standard stdbool.h and require Visual C++ 2015 (sizeof(bool) = 1 is now also true on MSVC build) - [@matthiasblaesing](https://github.com/matthiasblaesing).

Release 4.3.0
=============
Expand Down
Binary file modified lib/native/win32-x86-64.jar
Binary file not shown.
Binary file modified lib/native/win32-x86.jar
Binary file not shown.
10 changes: 0 additions & 10 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,11 @@ else
# Mingw compiler
LDFLAGS=-o $@ -shared
FFI_ENV+=CXXCPP="$(CPP)"

ifneq ($(ARCH),amd64)
CC=$(MINGW_PREFIX)gcc
CPP=$(MINGW_PREFIX)gcc -E
LDFLAGS+=-Wl,--add-stdcall-alias
LIBS=-lpsapi
else
# mingw64 lacks SEH, so MSVC build is preferred
CC=$(MINGW)
# No SEH under mingw64, thus no HAVE_PROTECTION
CDEFINES=-DPSAPI_VERSION=1
LD = $(CC)
LIBS= -lmingwex -lpsapi -lkernel32 -lmsvcrt
endif
endif

endif

Expand Down
7 changes: 0 additions & 7 deletions native/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,8 @@ static int _protect;
#ifdef __cplusplus
extern "C" {
#else
#if defined(_MSC_VER)
// At least until I upgrace to 2013-era MSVS
typedef int bool;
#define true 1
#define false 0
#else
#include <stdbool.h>
#endif
#endif

#define MEMCPY(ENV,D,S,L) do { \
PSTART(); memcpy(D,S,L); PEND(ENV); \
Expand Down
44 changes: 12 additions & 32 deletions www/WindowsDevelopmentEnvironment.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To use the MS compiler, ensure that the appropriate 32-bit or 64-bit versions
of cl.exe/ml.exe/ml64.exe/link.exe are in your PATH and that the INCLUDE and
LIB environment variables are set properly (as in VCVARS.BAT).

Sample configuration setting up INCLUDE/LIB:
Sample configuration setting up INCLUDE/LIB (see an alternative below):

``` shell
export MSVC="/c/Program Files (x86)/Microsoft Visual Studio 10.0/vc"
Expand Down Expand Up @@ -67,55 +67,35 @@ windows.

<pre>
0. Start-Point: A clean Windows 10 Installation with all patches as of 2016-06-10
1. Install Windows SDK 7.1:

Version registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full

Relevant attribute: VERSION

1. Note down the values in the version value (Windows 10 pure with patches as of 2016-06-10: 4.6.01038)
2. Change ownership of the registry keys to your current user (Open permissions for the key and choose "Extended")
3. Add full access righs for your current user to the permissions
4. Change both version attributes to 4.0.30319
5. Download and Install Windows SDK 7.1 with defaults: http://www.microsoft.com/en-us/download/details.aspx?id=8279
6. Restore Version from first item of this list


2. Install Oracle JDK 8u92 (64 bit)
1. Install Visual C++ Build Tools 2015 (http://landinghub.visualstudio.com/visual-cpp-build-tools) (the 8.1 SDK is enough)
2. Install Oracle JDK 8u121 (64 bit)
3. Install Cygwin (https://cygwin.com/install.html)
- make
- automake
- automake1.15
- libtool
- mingw64-x86_64-gcc-g++ (Version 5.3.0-1)
- mingw64-x86_64-gcc-core (Version 5.3.0-1)
- mingw64-x86_64-gcc-g++ (Version 5.4.0-3)
- mingw64-x86_64-gcc-core (Version 5.4.0-2)
- gcc-g++
- diffutils
- git
4. Ensure ant, maven, cygwin are accessible from the PATH
5. Run
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd /Release /x64
"C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" x64
inside a windows command prompt
6. Point JAVA_HOME to the root of a 64 Bit JDK
7. Run native build


For 32bit:

- Install:
- mingw64-i686-gcc-g++ (Version 5.3.0-1)
- mingw64-i686-gcc-core (Version 5.3.0-1)
- mingw64-i686-gcc-g++ (Version 5.4.0-3)
- mingw64-i686-gcc-core (Version 5.4.0-2)
- Modify the recipe:
- Step 2:
Install JDK 8u121 (32 bit)
- Step 5:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd /Release /x86
"C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" x86
- Step 6:
Point JAVA_HOME to the root of a 32 Bit JDK

To build with Visual Studio 2015:
- Instead of Step 5 start the build environments from start menu:
- VS2015 x86 Native Tools
- VS2015 x64 Native Tools
- Run steps 6+7 inside that environment
</pre>

0 comments on commit b37a652

Please sign in to comment.