summaryrefslogtreecommitdiff
path: root/javaunohelper/source/preload.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-04-18 13:16:41 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-04-18 13:27:31 +0200
commit96488510c006785bba22c1039885c03e95ac4832 (patch)
tree20fdaa3131b63df8c81497cc332ebb105b34db61 /javaunohelper/source/preload.cxx
parent000d3aaca5e8b0bab4689f753e8025d73e5bcded (diff)
Let juhx.dll export undecorated symbols on Windows
...otherwise preload.cxx in juh.dll will not be able to find them via osl_getFunctionSymbol. What apparently happens is that JNICALL expanding to __stdcall decorates symbol names with _...@NN. This likely was hidden in pre-gbuild times thanks to the use of def files. (On a side note, the JVM appears to contain special code to find syms for native methods in both decorated and undecorated form; that explains why it picks up the decorated symbols from juh.dll just fine.) There is no need for the functions in juhx.dll (called from the juh.dll wrapper) to adhere to JNICALL (in fact, things would likely be easier to maintain if the juhx.dll functions also used different names than their juh.dll wrappers). However, what complicates this patch is that for DISABLE_DYNLOADING, the juh wrapper and its preload.cxx is elided, and the code that would normally go into the juhx library goes into the juh library (and thus needs to stick to JNICALL, and also needs to use the right function names). Change-Id: I66611648f1f79f57f0c1b23fb7a801da2d7b86c5
Diffstat (limited to 'javaunohelper/source/preload.cxx')
-rw-r--r--javaunohelper/source/preload.cxx21
1 files changed, 9 insertions, 12 deletions
diff --git a/javaunohelper/source/preload.cxx b/javaunohelper/source/preload.cxx
index 5575af033eda..f7f5fd786d85 100644
--- a/javaunohelper/source/preload.cxx
+++ b/javaunohelper/source/preload.cxx
@@ -17,12 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
#include "jni.h"
#include "rtl/ustring.hxx"
#include "osl/module.h"
+#include "juhx-export-types.hxx"
+
// In retrospect, the reason to create a juh wrapper around the juhx library was
// probably because java.lang.System.loadLibrary uses RTLD_LOCAL, so uniqueness
// of GCC RTTI symbols needed for exception handling would not be guaranteed.
@@ -34,16 +37,10 @@
extern "C"
{
-typedef jboolean (JNICALL * fptr_writeInfo)(
- JNIEnv *, jclass, jstring, jobject, jobject, jobject );
-typedef jobject (JNICALL * fptr_getFactory)(
- JNIEnv *, jclass, jstring, jstring, jobject, jobject, jobject );
-typedef jobject (JNICALL * fptr_bootstrap)(
- JNIEnv *_env, jclass, jstring, jobjectArray, jobject );
-static fptr_writeInfo s_writeInfo;
-static fptr_getFactory s_getFactory;
-static fptr_bootstrap s_bootstrap;
+static javaunohelper::detail::Func_writeInfo * s_writeInfo;
+static javaunohelper::detail::Func_getFactory * s_getFactory;
+static javaunohelper::detail::Func_bootstrap * s_bootstrap;
static bool s_inited = false;
extern "C" { static void SAL_CALL thisModule() {} }
@@ -67,16 +64,16 @@ static bool inited_juhx( JNIEnv * jni_env )
{
OUString symbol =
"Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo";
- s_writeInfo = (fptr_writeInfo)osl_getFunctionSymbol(
+ s_writeInfo = (javaunohelper::detail::Func_writeInfo *)osl_getFunctionSymbol(
hModule, symbol.pData );
symbol =
"Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory";
- s_getFactory = (fptr_getFactory)osl_getFunctionSymbol(
+ s_getFactory = (javaunohelper::detail::Func_getFactory *)osl_getFunctionSymbol(
hModule, symbol.pData );
symbol =
"Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap";
s_bootstrap =
- (fptr_bootstrap)osl_getFunctionSymbol( hModule, symbol.pData );
+ (javaunohelper::detail::Func_bootstrap *)osl_getFunctionSymbol( hModule, symbol.pData );
if (0 == s_writeInfo ||
0 == s_getFactory ||