[Pyrex] Undefined symbol _Py_ZeroStruct
Franck Pommereau
pommereau at univ-paris12.fr
Fri Oct 2 10:28:38 CEST 2009
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 = Java_Hello_pyinit(NULL,NULL,(jint)42);
for (i=0; i <= 5; i++) {
printf("42 + %i = %i\n", i, (int)Java_Hello_pyadd(NULL,NULL,obj,i));
}
return 0;
}
More information about the Pyrex
mailing list