I am making a viewing program that needs to acces C(++)-code. I have compiled
a Native library (libLoad.so) by means of the following commands :

g++ -fPIC-c -I[jdk-root]/include -I[jdk-root]/include/genunix Load.cc Load.o
ld -shared Load.o -o libLoad.so

When I run my java-program the following error occurs:
...../libLoad.so: undefined symbol: __eh_pc (libLoad.so)

the c++ code is:
#include <jni.h> 
#include "Load.h" 
#include <stdio.h> 
#include <iostream.h> 
#include <fstream.h> 
#include <stdlib.h> 
 

JNIEXPORT void JNICALL Java_SIgnalViewer_SIgnalViewerFrame_sumArray(JNIEnv *env, 
jobject obj, jintArray java_array, jstring name, jint count, jint bsize, jint sliceno, 
jint frames) 
{ 
        struct CPP_array{unsigned short int Value[256][256];}; 
        int q,i,j,w, search_size; 
        search_size=((sliceno-1)*bsize*frames)+(count*bsize); 
        const char *filename=env->GetStringUTFChars(name,0); 
        struct CPP_array Array; 

        ifstream LoadArray(filename,ios::in|ios::binary); 
        if(!(LoadArray) )
        {       cout<<"Cannot open file\n"; 
                //return 0; 
        } 
        LoadArray.seekg(search_size,ios::beg); 
        LoadArray.read((unsigned char *)&Array,sizeof(CPP_array)); 
        LoadArray.close(); 
        env->ReleaseStringUTFChars(name,filename); 

        jsize array_len=env->GetArrayLength(java_array); 
        jint *array_p=env->GetIntArrayElements(java_array,0); 
        for(i=0;i<256;i++) 
        { 
                for(j=0;j<256;j++) 
                { 
                        array_p[(i*256)+j]=Array.Value[i][j]; 
                } 
        } 
        env->ReleaseIntArrayElements(java_array,array_p,0);      
} 

I believe the problem is related to libstdc++.so, __eh_pc is only to be found
in that shared library, but I do not know how to make it work.
The version of my libstdc++ is : 2.8.0
I am running redhat 5.2

Does anybody know what I am doing wrong ??
Any help is greatly appreciated, I've been stuck on this for days now :-(

Dennis Riedijk

Reply via email to