Hi,
I¹ve been using JNA to talk to the Python library on OS X 10.5. My
particular library is located in /usr/lib, so I¹m not sure if this is the
library that shipped with 10.5, or the one from MacPorts.
I haven¹t had any trouble hooking up to the methods that will start an
interpreter, run scripts, or even fork threads, but when trying to add a
module through the method Py_InitModule4 (the only one that is visible).
If I run nm on the library I get the following info:
libpython.dylib:single module: 0008bf80 (__TEXT,__text) external
_Py_InitModule4
Should this be visible to JNA?
When running my test I always get the following stack trace:
java.lang.UnsatisfiedLinkError: Error looking up function 'Py_InitModule4':
dlsym(0x10011a510, Py_InitModule4): symbol not found
at com.sun.jna.Function.<init>(Function.java:129)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:232)
at com.sun.jna.Library$Handler.invoke(Library.java:191)
at $Proxy1.Py_InitModule4(Unknown Source)
at edu.gemini.python.PythonService.addModule(PythonService.java:151)
at
edu.gemini.python.PythonExtensionTest.testSimpleModule(PythonExtensionTest.j
ava:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
It doesn¹t seem to matter if I change the number or type or args, etc., JNA
can¹t find the method.
Cheers,