Re: Undefined symbol _Py_ZeroStruct
Franck Pommereau <[email protected]> Fri, 02 Oct 2009 10:28:38 +0200
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
I've tried to use my library from a pure C program, it works perfectly.
The link error occurs only when the library is loaded by the JVM.
Below is the C program. Notice that I pass null pointers for the
expected JNI objects, but this is no problem since they are never used.
Does anyone has ideas about linkage differences between a C program and
the JVM? I've tried to explicitly load in the Java program all the
library listed by "ldd _hello.so" and "ldd /path/to/libpython.so" but
this does not change anything.
Franck
/**** tester.c *****/
#include <Python.h>
#include <jni.h>
#include "cythonjni.h"
#include "_hello.h"
#include <stdio.h>
int main (int argc, char** argv) {
jlong obj;
jint i;
JNI_OnLoad(NULL,NULL);
obj =3D Java_Hello_pyinit(NULL,NULL,(jint)42);
for (i=3D0; i <=3D 5; i++) {
printf("42 + %i =3D %i\n", i, (int)Java_Hello_pyadd(NULL,NULL,obj,i));
}
return 0;
}