Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
814ea357
Commit
814ea357
authored
Apr 08, 2015
by
j4cbo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29 from forderud/master
Work-arounds to make Djinni build on Windows with MSVC >=2013
parents
a5717a04
0b281403
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
support-lib/jni/djinni_support.cpp
support-lib/jni/djinni_support.cpp
+10
-1
support-lib/jni/djinni_support.hpp
support-lib/jni/djinni_support.hpp
+19
-5
No files found.
support-lib/jni/djinni_support.cpp
View file @
814ea357
...
@@ -134,7 +134,12 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha
...
@@ -134,7 +134,12 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha
const
char
*
file_basename
=
slash
?
slash
+
1
:
file
;
const
char
*
file_basename
=
slash
?
slash
+
1
:
file
;
char
buf
[
256
];
char
buf
[
256
];
#if (defined _MSC_VER) && (_MSC_VER < 1900)
// snprintf not implemented on MSVC prior to 2015
_snprintf
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
#else
snprintf
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
snprintf
(
buf
,
sizeof
buf
,
"djinni (%s:%d): %s"
,
file_basename
,
line
,
check
);
#endif
jclass
cassert
=
env
->
FindClass
(
"java/lang/AssertionError"
);
jclass
cassert
=
env
->
FindClass
(
"java/lang/AssertionError"
);
assert
(
cassert
);
assert
(
cassert
);
...
@@ -398,7 +403,11 @@ std::string jniUTF8FromString(JNIEnv * env, const jstring jstr) {
...
@@ -398,7 +403,11 @@ std::string jniUTF8FromString(JNIEnv * env, const jstring jstr) {
return
out
;
return
out
;
}
}
__attribute__
((
weak
))
#ifdef _MSC_VER
// weak attribute not supported by MSVC
#else
__attribute__
((
weak
))
#endif
void
jniSetPendingFromCurrent
(
JNIEnv
*
env
,
const
char
*
/*ctx*/
)
noexcept
{
void
jniSetPendingFromCurrent
(
JNIEnv
*
env
,
const
char
*
/*ctx*/
)
noexcept
{
try
{
try
{
throw
;
throw
;
...
...
support-lib/jni/djinni_support.hpp
View file @
814ea357
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
#include <jni.h>
#include <jni.h>
// work-around for missing noexcept and constexpr support in MSVC prior to 2015
#if (defined _MSC_VER) && (_MSC_VER < 1900)
# define noexcept _NOEXCEPT
# define constexpr
#endif
/*
/*
* Djinni support library
* Djinni support library
*/
*/
...
@@ -57,7 +63,11 @@ void jniExceptionCheck(JNIEnv * env);
...
@@ -57,7 +63,11 @@ void jniExceptionCheck(JNIEnv * env);
/*
/*
* Set an AssertionError in env with message message, and then throw jni_exception_pending.
* Set an AssertionError in env with message message, and then throw jni_exception_pending.
*/
*/
__attribute__
((
noreturn
))
#ifdef _MSC_VER
__declspec
(
noreturn
)
#else
__attribute__
((
noreturn
))
#endif
void
jniThrowAssertionError
(
JNIEnv
*
env
,
const
char
*
file
,
int
line
,
const
char
*
check
);
void
jniThrowAssertionError
(
JNIEnv
*
env
,
const
char
*
file
,
int
line
,
const
char
*
check
);
#define DJINNI_ASSERT(check, env) \
#define DJINNI_ASSERT(check, env) \
...
@@ -85,10 +95,14 @@ class GlobalRef : public std::unique_ptr<typename std::remove_pointer<PointerTyp
...
@@ -85,10 +95,14 @@ class GlobalRef : public std::unique_ptr<typename std::remove_pointer<PointerTyp
GlobalRefDeleter
>
{
GlobalRefDeleter
>
{
public:
public:
GlobalRef
()
{}
GlobalRef
()
{}
GlobalRef
(
GlobalRef
&&
obj
)
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
::
djinni
::
GlobalRefDeleter
>
(
std
::
move
(
obj
)
)
{}
GlobalRef
(
JNIEnv
*
env
,
PointerType
localRef
)
GlobalRef
(
JNIEnv
*
env
,
PointerType
localRef
)
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
GlobalRefDeleter
>
(
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
::
djinni
::
GlobalRefDeleter
>
(
static_cast
<
PointerType
>
(
env
->
NewGlobalRef
(
localRef
)),
static_cast
<
PointerType
>
(
env
->
NewGlobalRef
(
localRef
)),
GlobalRefDeleter
{}
::
djinni
::
GlobalRefDeleter
{}
)
{}
)
{}
};
};
...
@@ -100,7 +114,7 @@ class LocalRef : public std::unique_ptr<typename std::remove_pointer<PointerType
...
@@ -100,7 +114,7 @@ class LocalRef : public std::unique_ptr<typename std::remove_pointer<PointerType
public:
public:
LocalRef
()
{}
LocalRef
()
{}
LocalRef
(
JNIEnv
*
/*env*/
,
PointerType
localRef
)
LocalRef
(
JNIEnv
*
/*env*/
,
PointerType
localRef
)
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
LocalRefDeleter
>
(
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
::
djinni
::
LocalRefDeleter
>
(
localRef
)
{}
localRef
)
{}
explicit
LocalRef
(
PointerType
localRef
)
explicit
LocalRef
(
PointerType
localRef
)
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
LocalRefDeleter
>
(
:
std
::
unique_ptr
<
typename
std
::
remove_pointer
<
PointerType
>::
type
,
LocalRefDeleter
>
(
...
@@ -184,7 +198,7 @@ private:
...
@@ -184,7 +198,7 @@ private:
};
};
template
<
class
C
>
template
<
class
C
>
const
JniClassInitializer
JniClass
<
C
>::
s_initializer
{
allocate
}
;
const
JniClassInitializer
JniClass
<
C
>::
s_initializer
(
allocate
)
;
template
<
class
C
>
template
<
class
C
>
std
::
unique_ptr
<
C
>
JniClass
<
C
>::
s_singleton
;
std
::
unique_ptr
<
C
>
JniClass
<
C
>::
s_singleton
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment