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:Timothy Wall (twal@dev.java.net)
Date:Sep 10, 2008 10:07:52 am
List:net.java.dev.jna.users

Try "Py_InitModule4_64", and use the "-arch" flag when using "nm".

You can use an invocation mapper to automatically call the right internal function from the Py_InitModule interface function, you you can just define both and call the right one depending on the architecture.

On Sep 8, 2008, at 1:43 PM, Peter Schwarz wrote:

It seems more like missing methods, rather than an environment thing. I've double checked the location, and I can access other methods out of the library. Here's my modified test:

public void testSanity() throws Exception { final NativeLibrary lib = NativeLibrary.getInstance("python");

assertEquals("/usr/lib/libpython.dylib", lib.getFile().getPath());

Function fn = lib.getFunction("Py_Initialize"); assertNotNull(fn);

fn = lib.getFunction("Py_InitModule"); assertNotNull(fn); }

The only assertion that fails is that last one.

Cheers,

On 9/5/08 7:35 PM, "Timothy Wall" <twal@dev.java.net> wrote:

yeah, that works for me, so it must be an environmental or library issue.

lrwxr-xr-x 1 root wheel 16 Oct 26 2007 /usr/lib/libpython.dylib -> libpython2.dylib lrwxr-xr-x 1 root wheel 16 Oct 26 2007 /usr/lib/ libpython2.5.dylib -> libpython2.dylib lrwxr-xr-x 1 root wheel 68 Oct 26 2007 /usr/lib/ libpython2.dylib -

../../System/Library/Frameworks/Python.framework/Versions/2.5/Python

On Sep 5, 2008, at 7:25 PM, Peter Schwarz wrote:

I tried it the beanshell way, and I wasn't able to import the jna lib, so instead, I wrote the following unit test:

public class NativeLibraryTests extends TestCase { public void testSanity() throws Exception { final NativeLibrary lib = NativeLibrary.getInstance("python"); final Function fn = lib.getFunction("Py_InitModule4"); assertNotNull(fn); } }

I still get the following result:

java.lang.UnsatisfiedLinkError: Error looking up function 'Py_InitModule4': dlsym(0x10011a4d0, 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.NativeLibrary.getFunction(NativeLibrary.java:210) at edu .gemini .python.nativelib.NativeLibraryTests.testSanity(NativeLibraryTests .java:13) 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)