13 messages in net.java.dev.jna.usersRe: [jna-users] Error looking up func...
FromSent OnAttachments
Peter SchwarzSep 5, 2008 12:47 pm 
Timothy WallSep 5, 2008 1:10 pm 
Peter SchwarzSep 5, 2008 1:14 pm 
Timothy WallSep 5, 2008 1:45 pm 
Peter SchwarzSep 5, 2008 1:56 pm 
Timothy WallSep 5, 2008 3:34 pm 
Peter SchwarzSep 5, 2008 4:25 pm 
Timothy WallSep 5, 2008 10:35 pm 
Peter SchwarzSep 8, 2008 10:43 am 
Timothy WallSep 10, 2008 9:58 am 
Timothy WallSep 10, 2008 10:02 am 
Timothy WallSep 10, 2008 10:07 am 
Peter SchwarzSep 10, 2008 1:45 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Error looking up functionActions...
From:Peter Schwarz (psch@gemini.edu)
Date:Sep 5, 2008 1:14:58 pm
List:net.java.dev.jna.users

MacPorts usually puts stuff in /opt/local.

I suppose that means I'm using the shipped version with 10.5

What flags are you passing to nm, and which nm?

I called the following (using the default version in 10.5): nm -gmA libpython.dylib | grep InitModule

Naive question, but what's the beanshell? Is it a tool I could use to test thing?

Thanks,

Peter

On 9/5/08 10:10 AM, "Timothy Wall" <twal@dev.java.net> wrote:

Anyhow, I tried this from beanshell and the function loaded just fine, but Py_InitModule4 in my lib looks just like all the other symbols.

On Sep 5, 2008, at 3:48 PM, Peter Schwarz wrote:

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.java: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,

Peter Schwarz