Changeset 26662


Ignore:
Timestamp:
2013-01-10T15:56:18+13:00 (9 years ago)
Author:
davidb
Message:

Support for cross-compilation added. This particular set of changes focus on flags that assist cross-compilation with JNI. Comparable set of changes to the mgpp ones. Note the additional type-casting (intptr_t)

Location:
main/trunk/greenstone2/common-src/indexers/mg/jni
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/indexers/mg/jni/MGPassesWrapperImpl.c

    r16583 r26662  
    2020
    2121#include <jni.h>
     22
     23#ifdef __MINGW32__
     24
     25/* Cross compiling for Windows
     26 Want the type definitions in *win32* version of jni_md.h but
     27 this then leads to C-mangled style functions which we *don't*
     28 want.  The following achieves this */
     29
     30#undef JNIEXPORT
     31#undef JNIIMPORT
     32#undef JNICALL
     33
     34#define JNIEXPORT
     35#define JNIIMPORT
     36#define JNICALL
     37#endif
     38
     39
    2240#include <assert.h>
    2341#include "sysfuncs.h"
  • main/trunk/greenstone2/common-src/indexers/mg/jni/MGRetrieveWrapperImpl.c

    r25244 r26662  
    1919
    2020
     21#include <jni.h>
     22#ifdef __MINGW32__
     23
     24/* Cross compiling for Windows
     25 Want the type definitions in *win32* version of jni_md.h but
     26 this then leads to C-mangled style functions which we *don't*
     27 want.  The following achieves this */
     28
     29#undef JNIEXPORT
     30#undef JNIIMPORT
     31#undef JNICALL
     32
     33#define JNIEXPORT
     34#define JNIIMPORT
     35#define JNICALL
     36#endif
     37
    2138#include "MGWrapperImpl.h"
    22 #include <jni.h>
     39
    2340#include "org_greenstone_mg_MGRetrieveWrapper.h"
    2441
     
    213230                      jstring j_index)
    214231{
    215   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     232  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    216233
    217234  /* Get the index name as a C string */
     
    243260                         jlong j_docnum)
    244261{
    245   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     262  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    246263
    247264  char* index_path;
  • main/trunk/greenstone2/common-src/indexers/mg/jni/MGSearchWrapperImpl.c

    r25244 r26662  
    1919
    2020
     21#include <jni.h>
     22
     23#ifdef __MINGW32__
     24
     25/* Cross compiling for Windows
     26   Want the type definitions in *win32* version of jni_md.h but
     27   this then leads to C-mangled style functions which we *don't*
     28   want.  The following achieves this */
     29
     30#undef JNIEXPORT
     31#undef JNIIMPORT
     32#undef JNICALL
     33
     34#define JNIEXPORT
     35#define JNIIMPORT
     36#define JNICALL
     37#endif
     38
    2139#include "MGWrapperImpl.h"
    22 #include <jni.h>
    2340#include "org_greenstone_mg_MGSearchWrapper.h"
    2441
     
    252269                      jstring j_query)
    253270{
    254   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     271  MGWrapperData* data = (MGWrapperData*) (intptr_t)(*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    255272
    256273  char* index_path;
     
    517534                     jboolean j_on)
    518535{
    519   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     536  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    520537
    521538  if (j_on) {
     
    532549                     jboolean j_on)
    533550{
    534   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     551  MGWrapperData* data = (MGWrapperData*) (intptr_t)(*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    535552
    536553  if (j_on) {
     
    547564                        jint j_max)
    548565{
    549   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     566  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    550567  data->queryInfo->maxDocs = j_max;
    551568}
     
    570587                        jboolean j_on)
    571588{
    572   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     589  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    573590  data->queryInfo->needTermFreqs = j_on;
    574591}
     
    580597                      jstring j_index)
    581598{
    582   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     599  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    583600
    584601  /* Get the index name as a C string */
     
    606623                          jint j_mode)
    607624{
    608   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     625  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    609626  data->defaultBoolCombine = j_mode;
    610627}
     
    615632Java_org_greenstone_mg_MGSearchWrapper_getQueryParams(JNIEnv *j_env, jobject j_obj)
    616633{
    617   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
     634  MGWrapperData* data = (MGWrapperData*)(intptr_t) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data);
    618635  char result[512];  /* Assume this is big enough */
    619636
  • main/trunk/greenstone2/common-src/indexers/mg/jni/MGWrapperImpl.c

    r25244 r26662  
    1818 */
    1919
     20#include <jni.h>
     21
     22#ifdef __MINGW32__
     23
     24// Cross compiling for Windows
     25// Want the type definitions in *win32* version of jni_md.h but
     26// this then leads to C-mangled style functions which we *don't*
     27// want.  The following achieves this
     28
     29#undef JNIEXPORT
     30#undef JNIIMPORT
     31#undef JNICALL
     32
     33#define JNIEXPORT
     34#define JNIIMPORT
     35#define JNICALL
     36#endif
    2037
    2138#include "MGWrapperImpl.h"
    22 #include <jni.h>
    2339#include "org_greenstone_mg_MGWrapper.h"
     40
    2441
    2542#include "backend.h"
Note: See TracChangeset for help on using the changeset viewer.